1 | # Codecov NodeJS Uploader
|
2 |
|
3 | [![codecov.io](https://codecov.io/github/codecov/codecov-node/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-node?branch=master)
|
4 | [![NPM version][npm-image]][npm-url]
|
5 | [![Build Status][github-actions-image]][github-actions-url]
|
6 | [![Build Status][travis-image]][travis-url]
|
7 | [![Dependency Status][depstat-image]][depstat-url]
|
8 | [![Dev Dependency Status][devdepstat-image]][devdepstat-url]
|
9 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-node.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-node?ref=badge_shield)
|
10 |
|
11 | [Codecov.io](https://codecov.io/) support for node.js.
|
12 |
|
13 | ## Installation:
|
14 |
|
15 | Add the latest version of `codecov` to your package.json:
|
16 |
|
17 | ```
|
18 | npm install codecov --save-dev
|
19 | ```
|
20 |
|
21 | or
|
22 |
|
23 | ```
|
24 | yarn add codecov --dev
|
25 | ```
|
26 |
|
27 | ## Usage:
|
28 |
|
29 | This script ( `bin/codecov` ) detect your CI provider and all coverage reports and uploads them to Codecov.
|
30 |
|
31 | Once your app is instrumented for coverage, and building, simply call `./node_modules/.bin/codecov`.
|
32 |
|
33 | This library currently supports the following CI companies: [Travis CI](https://travis-ci.org/), [Travis](https://travis-ci.com/), [Appveyor](https://appveyor.com/), [CircleCI](https://circleci.com/), [Cirrus CI](https://cirrus-ci.org/), [Codeship](https://codeship.io/), [Drone](https://drone.io/), [Jenkins](http://jenkins-ci.org/), [Shippable](https://shippable.com/), [Semaphore](https://semaphoreapp.com/), [Wercker](https://wercker.com/), [Snap CI](https://snap-ci.com/), [Buildkite](https://buildkite.com/), [AWS CodeBuild](https://aws.amazon.com/codebuild/).
|
34 |
|
35 | #### Upload repo tokens
|
36 |
|
37 | > Repo tokens are **not** required for public repos tested on Travis-Org, CircleCI or AppVeyor.
|
38 |
|
39 | Repo tokens are necessary to distinguish your repository from others. You can find your repo token on your repository page at Codecov. Set this unique uuid to `CODECOV_TOKEN` in your environment variables.
|
40 |
|
41 | ```
|
42 | export CODECOV_TOKEN=":uuid-repo-token"
|
43 | # or
|
44 | ./node_modules/.bin/codecov --token=:token
|
45 | # or
|
46 | ./node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/codecov --pipe
|
47 | ```
|
48 |
|
49 | #### [Istanbul](https://github.com/gotwarlost/istanbul)
|
50 |
|
51 | **With Mocha:**
|
52 |
|
53 | ```sh
|
54 | istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec
|
55 | ./node_modules/.bin/codecov
|
56 | ```
|
57 |
|
58 | **With Jasmine:**
|
59 |
|
60 | ```sh
|
61 | istanbul cover jasmine-node --captureExceptions spec/
|
62 | ./node_modules/.bin/codecov
|
63 | ```
|
64 |
|
65 | **With Tape:**
|
66 |
|
67 | ```sh
|
68 | istanbul cover test.js
|
69 | ./node_modules/.bin/codecov
|
70 | ```
|
71 |
|
72 | [appveyor-url]: https://ci.appveyor.com/project/eddiemoore/codecov-node-s38o6/branch/master
|
73 | [github-actions-image]: https://github.com/codecov/codecov-node/workflows/Node%20CI/badge.svg
|
74 | [github-actions-url]: https://github.com/codecov/codecov-node/actions?query=workflow%3A%22Node+CI%22
|
75 | [travis-image]: https://travis-ci.org/codecov/codecov-node.svg?branch=master
|
76 | [travis-url]: https://travis-ci.org/codecov/codecov-node
|
77 | [npm-url]: https://npmjs.org/package/codecov
|
78 | [npm-image]: https://img.shields.io/npm/v/codecov.svg
|
79 | [depstat-url]: https://david-dm.org/codecov/codecov-node
|
80 | [depstat-image]: https://david-dm.org/codecov/codecov-node/status.svg
|
81 | [devdepstat-url]: https://david-dm.org/codecov/codecov-node?type=dev
|
82 | [devdepstat-image]: https://david-dm.org/codecov/codecov-node/dev-status.svg
|
83 |
|
84 | **With NYC**
|
85 |
|
86 | ```
|
87 | nyc npm test
|
88 | nyc report --reporter=lcov
|
89 | ./node_modules/.bin/codecov
|
90 | ```
|
91 |
|
92 | ## Troubleshooting
|
93 |
|
94 | If you're seeing an **HTTP 400 error when uploading reports to S3**, make sure you've updated to at least version 3.7.0.
|
95 |
|
96 |
|
97 | ## License
|
98 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-node.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-node?ref=badge_large) |
\ | No newline at end of file |