0.0.8 • Published 9 years ago
istanbul-coverage-slack v0.0.8
istanbul-coverage-slack
Sends coverage reports on Slack webhook.
Install
npm i --save-dev istanbul-coverage-slackBefore You run
Make sure You configure webhook on Your Slack team https://api.slack.com/incoming-webhooks
Put file bashout.json (example below) into root directory of Your project.
{
"reports": {
"files": ["coverage/coverage.json"]
},
"slack": {
"username": "Chuck Norris",
"channel": "reports",
"icon": "https://s3-us-west-2.amazonaws.com/slack-files2/bot_icons/2016-06-16/51472942259_48.png",
"timeout": 5000
},
"thresholds": [
{
"percent": 100,
"words": "excellent",
"color": "good"
},
{
"percent": 80,
"words": "nice",
"color": "warning"
},
{
"percent": 50,
"words": "do it better",
"color": "warning"
},
{
"percent": 40,
"words": "mad",
"color": "danger"
},
{
"percent": 0,
"words": "crap",
"color": "danger"
}
]
}Notice: Coverage report for You project must be generated. If not generate coverage report via istanbul. This coverage report should correspond with reports.files section located in bashout.json.
Run
Inside Your project root directory You can use on of following run sequence.
Via arguments
./node_modules/.bin/shout --SLACK_WEBHOOK_URL=https://hooks.slack.com/...Via env variables
export SLACK_WEBHOOK_URL=https://hooks.slack.com/... && ./node_modules/.bin/shoutVia npm task
...
"shout": "./node_modules/.bin/shout",
...export SLACK_WEBHOOK_URL=https://hooks.slack.com/... && npm run shoutAdditional parameters
--BRANCH_NAME- name of the branch--PROJECT_NAME- name of the project
You can also override bashout.json factors
--SLACK_CHANNEL- selected channel of Your Slack team--SLACK_TIMEOUT- in milliseconds request timeout to slack webhook (default 5000ms)--LOG-debugfor verbose
This will send coverage report into Slack webhook and Your message should look like below

Debug
If You have troubles with receiving messages launch for more information about any issues.
./node_modules/.bin/shout --LOG=debug