# istanbul-coverage-slack

> Sends coverage report on Slack webhook

Latest version **0.0.8** (published 2016-07-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install istanbul-coverage-slack
pnpm add istanbul-coverage-slack
yarn add istanbul-coverage-slack
bun add istanbul-coverage-slack
```

Provides the command `shout`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2016-07-11 |
| First published | 2016-07-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Krzysztof Pająk |
| Maintainers | exogenesick |

## Links

- npm: https://www.npmjs.com/package/istanbul-coverage-slack
- Repository: https://github.com/exogenesick/istanbul-coverage-slack
- Homepage: https://github.com/exogenesick/istanbul-coverage-slack#readme
- Issues: https://github.com/exogenesick/istanbul-coverage-slack/issues
- npm.io page: https://npm.io/package/istanbul-coverage-slack

## Dependencies (9)

- [q](https://npm.io/package/q.md) ^1.4.1
- [nconf](https://npm.io/package/nconf.md) ^0.8.4
- [is-url](https://npm.io/package/is-url.md) ^1.2.1
- [winston](https://npm.io/package/winston.md) ^2.2.0
- [istanbul](https://npm.io/package/istanbul.md) 0.4.4
- [slack-node](https://npm.io/package/slack-node.md) ^0.2.0
- [underscore](https://npm.io/package/underscore.md) ^1.8.3
- [app-root-path](https://npm.io/package/app-root-path.md) ^1.2.1
- [request-promise](https://npm.io/package/request-promise.md) ^3.0.0

## Recent versions

- 0.0.8 (latest) — 2016-07-11
- 0.0.7 — 2016-07-09
- 0.0.6 — 2016-07-08
- 0.0.3 — 2016-07-08

## README

# istanbul-coverage-slack

Sends coverage reports on Slack webhook.

[![Build Status](https://travis-ci.org/exogenesick/istanbul-coverage-slack.svg?branch=master)](https://travis-ci.org/exogenesick/istanbul-coverage-slack) [![Coverage Status](https://coveralls.io/repos/github/exogenesick/istanbul-coverage-slack/badge.svg?branch=master)](https://coveralls.io/github/exogenesick/istanbul-coverage-slack?branch=master)

## Install

```
npm i --save-dev istanbul-coverage-slack
```

## Before You run

Make sure You configure webhook on Your Slack team https://api.slack.com/incoming-webhooks

Put file ```shout.json``` (example below) into root directory of Your project.

```json
{
  "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 ```shout.json```.

## Run

Inside Your project root directory You can use on of following run sequence.

### Via arguments

```bash
./node_modules/.bin/shout --SLACK_WEBHOOK_URL=https://hooks.slack.com/...
```

### Via env variables

```bash
export SLACK_WEBHOOK_URL=https://hooks.slack.com/... && ./node_modules/.bin/shout
```

### Via npm task

```json
...
"shout": "./node_modules/.bin/shout",
...
```

```bash
export SLACK_WEBHOOK_URL=https://hooks.slack.com/... && npm run shout
```

### Additional parameters

* ```--BRANCH_NAME``` - name of the branch
* ```--PROJECT_NAME``` - name of the project

You can also override ```shout.json``` factors

* ```--SLACK_CHANNEL``` - selected channel of Your Slack team
* ```--SLACK_TIMEOUT``` - in milliseconds request timeout to slack webhook (default 5000ms)
* ```--LOG``` - ```debug``` for verbose

This will send coverage report into Slack webhook and Your message should look like below

![Message example](https://s31.postimg.org/tv3esvdxn/slack_webhook_example.png "Message example")

## Debug

If You have troubles with receiving messages launch for more information about any issues.

```bash
./node_modules/.bin/shout --LOG=debug
```

---
_Source: https://npm.io/package/istanbul-coverage-slack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
