mocha-circleci-reporter0.0.3 • Public • Published
A Mocha reporter specifically for Circle CI.
Install the reporter as a development dependency:
npm install mocha --save-devnpm install mocha-circleci-reporter --save-dev
package.json to use the reporter when running Mocha:
mocha-junit-reporter will output
test-results.xml by default. CircleCI needs the results in the
Either update your
circle.yml to copy over the `test-results.xml:
test:override:- npm run test- if [[ -e test-results.xml ]]; then cp test-results.xml $CIRCLE_TEST_REPORTS/test-results.xml; fi
or set the
Why another reporter?
As of Mocha 2.x, its not possible to use multple reporters out of the box.
This complicates things when dealing with CI systems like Circle CI that
require a format such as jUnit XML
as a lot of the goodness that is written to console when running the default
To overcome this, we combine the output of both the
Example spec output:
Example jUnit output:
There is work underway in Mocha 3.x to move to a plugin architecture that would make multiple reporters dead simple, until then I hope this simplifies things.