| 1 |
# Integrating with coveralls.io |
| 2 |
|
| 3 |
[coveralls.io](https://coveralls.io) is a great tool for adding |
| 4 |
coverage reports to your GitHub project. Here's how to get nyc |
| 5 |
integrated with coveralls and travis-ci.org: |
| 6 |
|
| 7 |
1. add the coveralls and nyc dependencies to your module: |
| 8 |
|
| 9 |
```shell |
| 10 |
npm install coveralls nyc --save-dev |
| 11 |
``` |
| 12 |
|
| 13 |
2. update the scripts in your package.json to include these bins: |
| 14 |
|
| 15 |
```json |
| 16 |
{ |
| 17 |
"scripts": { |
| 18 |
"test": "nyc mocha", |
| 19 |
"coverage": "nyc report --reporter=text-lcov | coveralls" |
| 20 |
} |
| 21 |
} |
| 22 |
``` |
| 23 |
|
| 24 |
3. For private repos, add the environment variable `COVERALLS_REPO_TOKEN` to Travis CI. |
| 25 |
|
| 26 |
4. add the following to your `.travis.yml`: |
| 27 |
|
| 28 |
```yaml |
| 29 |
after_success: npm run coverage |
| 30 |
``` |
| 31 |
|
| 32 |
That's all there is to it! |
| 33 |
|
| 34 |
> Note: by default coveralls.io adds comments to pull-requests on GitHub, this can feel intrusive. To disable this, click on your repo on coveralls.io and uncheck `LEAVE COMMENTS?`. |