mocha-ci-slack-reporter
Slack reporter for Mocha when running in CI environments.
Although this can be used in non-CI environments too, it is suited for CI environment in that it is able to report build number, build URL, etc alongside standard test pass/failed information.
It posts a single notification to your Slack channel with a summary of the test results.
Installation
$ npm install mocha-ci-slack-reporter
Usage
All options:
url
(mandatory) - Slack incoming webhook URLusername
(mandatory) - Username to post aschannel
(mandatory) - Channel to post tologsUrl
- URL to logs page (appended to message text as a View logs link)passEmoji
- Emoji to use for test pass (default is 👌)failEmoji
- Emoji to use for test failure (default is 💣)failuresOnly
- Whether to only report failures (default isfalse
)
via Command-line
$ mocha test --reporter mocha-ci-slack-reporter --reporter-options username=name,channel=#channel_name,...
via API
var mocha = reporter: 'mocha-ci-slack-reporter' reporterOptions: url: 'https://hooks.slack.com/...' username: 'reporter' channel: '#mychannel' logsUrl: 'https://ci.com/project/...' ;
License
MIT - see LICENSE.md