mocha-env-reporter
v4.0.0
Published
ci/dev environment aware mocha reporter
Downloads
6,387
Readme
mocha-env-reporter
A mocha reporter that switches output format between built-in 'spec' and customised CI reporters base on where tests are being executed - locally or ci. Actual switch is implemented by detecting an environment variable unique to each CI environment. The default is 'spec' builtin mocha reporter.
The reporter also supports an environment variable mocha_reporter
in which you can set an arbitrary environment reporter. This is useful if you use an unidentified continous integration service.
Currently supported custom CI environments (see defaults.json
):
- Teamcity
- bamboo
- jenkins
install
npm install --save-dev mocha-env-reporter
usage
In you package.json append --reporter mocha-env-reporter
to your mocha test command, ex.
...
"scripts": {
"test": "mocha --reporter mocha-env-reporter"
},
...
configuration
In order to override the choice of reporter simply set environment variable mocha_reporter
to the reporter name (example specs
).
The default reporters per environments are defined at defaults.json
License
Licensed under MIT License.