Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #12] Support custom external reporters #13

Merged
merged 1 commit into from Oct 30, 2016

Conversation

stanleyhlng
Copy link
Owner

This PR supports custom external reporters. Example: mocha-junit-reporter

config

➜  mocha-multi-reporters-demo git:(mocha-junit-reporter) ✗ cat config.json
{
    "reporterEnabled": "tap,xunit,mocha-junit-reporter",
    "xunitReporterOptions": {
        "output": "xunit-custom.xml"
    },
    "mochaJunitReporterReporterOptions": {
    "mochaFile": "junit-custom.xml"
    }
}

tap reporter result

➜  mocha-multi-reporters-demo git:(mocha-junit-reporter) ✗ npm test

> mocha-multi-reporters-demo@1.0.9 test /Users/sng/Projects/stanleyhlng/github/mocha-multi-reporters-demo
> mocha --reporter mocha-multi-reporters --reporter-options configFile=config.json

1..4
ok 1 mocha-test 1 sample test 1.1
ok 2 mocha-test 1 sample test 1.2
ok 3 mocha-test 2 sample test 2.1
ok 4 mocha-test 2 sample test 2.2 # SKIP -
# tests 3
# pass 3
# fail 0

mocha-junit-reporter reporter result

➜  mocha-multi-reporters-demo git:(mocha-junit-reporter) ✗ cat junit-custom.xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="0.002" tests="4" failures="0" skipped="1">
  <testsuite name="Root Suite" timestamp="2016-10-30T00:54:52" tests="0" failures="0" time="0">
  </testsuite>
  <testsuite name="mocha-test #1" timestamp="2016-10-30T00:54:52" tests="2" failures="0" time="0.002">
    <testcase name="mocha-test #1 sample test #1.1" time="0.001" classname="sample test #1.1">
    </testcase>
    <testcase name="mocha-test #1 sample test #1.2" time="0.001" classname="sample test #1.2">
    </testcase>
  </testsuite>
  <testsuite name="mocha-test #2" timestamp="2016-10-30T00:54:52" tests="2" failures="0" time="0">
    <testcase name="mocha-test #2 sample test #2.1" time="0" classname="sample test #2.1">
    </testcase>
  </testsuite>
</testsuites>%

xunit reporter result

➜  mocha-multi-reporters-demo git:(mocha-junit-reporter) ✗ cat xunit-custom.xml
<testsuite name="Mocha Tests" tests="4" failures="0" errors="0" skipped="1" timestamp="Sun, 30 Oct 2016 00:54:52 GMT" time="0.007">
<testcase classname="mocha-test #1" name="sample test #1.1" time="0.001"/>
<testcase classname="mocha-test #1" name="sample test #1.2" time="0.001"/>
<testcase classname="mocha-test #2" name="sample test #2.1" time="0"/>
<testcase classname="mocha-test #2" name="sample test #2.2" time="0"><skipped/></testcase>
</testsuite>

@coveralls
Copy link

coveralls commented Oct 30, 2016

Coverage Status

Coverage decreased (-5.2%) to 87.143% when pulling 8ee1d05 on external-reporters into 867306e on master.

@stanleyhlng stanleyhlng changed the base branch from master to release October 30, 2016 01:09
@stanleyhlng stanleyhlng merged commit 359cbf6 into release Oct 30, 2016
@stanleyhlng stanleyhlng deleted the external-reporters branch October 30, 2016 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants