coveralls
Advanced tools
Comparing version 3.0.8 to 3.0.9
@@ -7,3 +7,2 @@ 'use strict'; | ||
const logger = require('./logger')(); | ||
const coberturaParse = require('cobertura-parse'); | ||
@@ -58,5 +57,3 @@ const detailsToCoverage = (length, details) => { | ||
filepath = path.resolve(process.cwd(), filepath); | ||
const filetype = options.filetype || 'lcov'; | ||
const parser = filetype === 'cobertura' ? coberturaParse.parseContent : lcovParse; | ||
parser(input, (err, parsed) => { | ||
lcovParse(input, (err, parsed) => { | ||
if (err) { | ||
@@ -63,0 +60,0 @@ logger.error('error from lcovParse: ', err); |
@@ -9,3 +9,3 @@ 'use strict'; | ||
function getLogLevel() { | ||
if (index.options.verbose || Boolean(process.env.NODE_COVERALLS_DEBUG)) { | ||
if (index.options.verbose || process.env.NODE_COVERALLS_DEBUG === 1 || process.env.NODE_COVERALLS_DEBUG === '1') { | ||
return 'debug'; | ||
@@ -12,0 +12,0 @@ } |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "3.0.8", | ||
"version": "3.0.9", | ||
"bugs": { | ||
@@ -17,6 +17,4 @@ "url": "https://github.com/nickmerwin/node-coveralls/issues" | ||
"test-cov": "nyc npm run mocha", | ||
"pretest-coveralls": "npm run pretest", | ||
"test-coveralls": "nyc npm run mocha && shx cat ./coverage/lcov.info | node ./bin/coveralls.js --verbose", | ||
"pretest": "cross-env-shell \"echo TRAVIS_JOB_ID $TRAVIS_JOB_ID\"", | ||
"test": "snyk test && npm run lint && npm run mocha" | ||
"test": "npm run lint && npm run mocha" | ||
}, | ||
@@ -41,3 +39,2 @@ "bin": { | ||
"dependencies": { | ||
"cobertura-parse": "^1.0.5", | ||
"js-yaml": "^3.13.1", | ||
@@ -50,12 +47,8 @@ "lcov-parse": "^1.0.0", | ||
"devDependencies": { | ||
"cross-env": "^5.2.1", | ||
"nyc": "^14.1.1", | ||
"istanbul": "^0.4.5", | ||
"jshint": "^2.10.3", | ||
"mocha": "^6.2.2", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"nyc": "^14.1.1", | ||
"should": "^9.0.2", | ||
"shx": "^0.3.2", | ||
"sinon-restore": "^1.0.1", | ||
"snyk": "^1.250.0" | ||
"sinon-restore": "^1.0.1" | ||
}, | ||
@@ -62,0 +55,0 @@ "engines": { |
136
README.md
# node-coveralls | ||
[![Build Status][ci-image]][ci-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
[![Known Vulnerabilities](https://snyk.io/test/github/nickmerwin/node-coveralls/badge.svg)](https://snyk.io/test/github/nickmerwin/node-coveralls) | ||
[Coveralls.io](https://coveralls.io/) support for node.js. Get the great coverage reporting of coveralls.io and add a cool coverage button ( like the one above ) to your README. | ||
[Coveralls.io](https://coveralls.io/) support for Node.js. Get the great coverage reporting of coveralls.io and add a cool coverage button (like the one above) to your README. | ||
Supported CI services: [travis-ci](https://travis-ci.org/), [codeship](https://www.codeship.io/), [circleci](https://circleci.com/), [jenkins](http://jenkins-ci.org/), [Gitlab CI](http://gitlab.com/), [AppVeyor](http://appveyor.com/), [Buildkite](https://buildkite.com/) | ||
Supported CI services: [Travis CI](https://travis-ci.org/), [CodeShip](https://codeship.com/), [CircleCI](https://circleci.com/), [Jenkins](https://jenkins.io/), [Gitlab CI](https://gitlab.com/), [AppVeyor](https://www.appveyor.com/), [Buildkite](https://buildkite.com/), [GitHub Actions CI](https://github.com/features/actions) | ||
## Installation: | ||
Add the latest version of `coveralls` to your package.json: | ||
``` | ||
```shell | ||
npm install coveralls --save-dev | ||
@@ -17,3 +18,4 @@ ``` | ||
If you're using mocha, add `mocha-lcov-reporter` to your package.json: | ||
``` | ||
```shell | ||
npm install mocha-lcov-reporter --save-dev | ||
@@ -24,46 +26,68 @@ ``` | ||
This script ( `bin/coveralls.js` ) can take standard input from any tool that emits the lcov data format (including [mocha](http://mochajs.org/)'s [LCov reporter](https://npmjs.org/package/mocha-lcov-reporter)) and send it to coveralls.io to report your code coverage there. | ||
This script `bin/coveralls.js` can take standard input from any tool that emits the lcov data format (including [mocha](https://mochajs.org/)'s [LCOV reporter](https://npmjs.org/package/mocha-lcov-reporter)) and send it to coveralls.io to report your code coverage there. | ||
Once your app is instrumented for coverage, and building, you need to pipe the lcov output to `./node_modules/coveralls/bin/coveralls.js`. | ||
This library currently supports [travis-ci](https://travis-ci.org/) with no extra effort beyond piping the lcov output to coveralls. However, if you're using a different build system, there are a few environment variables that are necessary: | ||
* COVERALLS_SERVICE_NAME (the name of your build system) | ||
* COVERALLS_REPO_TOKEN (the secret repo token from coveralls.io) | ||
This library currently supports [Travis CI](https://travis-ci.org/) with no extra effort beyond piping the lcov output to coveralls. However, if you're using a different build system, there are a few environment variables that are necessary: | ||
- `COVERALLS_SERVICE_NAME` (the name of your build system) | ||
- `COVERALLS_REPO_TOKEN` (the secret repo token from coveralls.io) | ||
- `COVERALLS_GIT_BRANCH` (the branch name) | ||
There are optional environment variables for other build systems as well: | ||
* COVERALLS_SERVICE_JOB_ID (an id that uniquely identifies the build job) | ||
* COVERALLS_RUN_AT (a date string for the time that the job ran. RFC 3339 dates work. This defaults to your | ||
build system's date/time if you don't set it.) | ||
* COVERALLS_PARALLEL (more info here: https://docs.coveralls.io/parallel-build-webhook) | ||
### [Jest](https://facebook.github.io/jest/) | ||
- Install [jest](https://facebook.github.io/jest/docs/en/getting-started.html) | ||
- Use the following to run tests and push files to coveralls: | ||
```sh | ||
jest --coverage --coverageReporters=text-lcov | coveralls | ||
- `COVERALLS_SERVICE_JOB_ID` (an id that uniquely identifies the build job) | ||
- `COVERALLS_RUN_AT` (a date string for the time that the job ran. RFC 3339 dates work. This defaults to your build system's date/time if you don't set it.) | ||
- `COVERALLS_PARALLEL` (more info here: <https://docs.coveralls.io/parallel-build-webhook>) | ||
### GitHub Actions CI | ||
If you are using GitHub Actions CI, you should look into [coverallsapp/github-action](https://github.com/coverallsapp/github-action). | ||
If you prefer to use this package you can do it like this: | ||
```yml | ||
env: | ||
COVERALLS_REPO_TOKEN: "${{ secrets.COVERALLS_REPO_TOKEN }}" | ||
COVERALLS_GIT_BRANCH: "${{ github.ref }}" | ||
``` | ||
Check out an example [here](https://github.com/Ethan-Arrowood/harperdb-connect/blob/master/.travis.yml) which makes use of Travis-CI build stages | ||
### [Mocha](http://mochajs.org/) + [Blanket.js](https://github.com/alex-seville/blanket) | ||
- Install [blanket.js](http://blanketjs.org/) | ||
### [Jest](https://jestjs.io/) | ||
- Install [jest](https://jestjs.io/docs/en/getting-started) | ||
- Use the following to run tests and push files to coveralls: | ||
```sh | ||
jest --coverage --coverageReporters=text-lcov | coveralls | ||
``` | ||
Check out an example [here](https://github.com/Ethan-Arrowood/harperdb-connect/blob/master/.travis.yml) which makes use of Travis CI build stages | ||
### [Mocha](https://mochajs.org/) + [Blanket.js](https://github.com/alex-seville/blanket) | ||
- Install [blanket.js](https://github.com/alex-seville/blanket) | ||
- Configure blanket according to [docs](https://github.com/alex-seville/blanket/blob/master/docs/getting_started_node.md). | ||
- Run your tests with a command like this: | ||
```sh | ||
NODE_ENV=test YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha \ | ||
--require blanket \ | ||
--reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js | ||
``` | ||
### [Mocha](http://mochajs.org/) + [JSCoverage](https://github.com/fishbar/jscoverage) | ||
```sh | ||
NODE_ENV=test YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha \ | ||
--require blanket \ | ||
--reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js | ||
``` | ||
Instrumenting your app for coverage is probably harder than it needs to be (read [here](http://www.seejohncode.com/2012/03/13/setting-up-mocha-jscoverage/)), but that's also a necessary step. | ||
### [Mocha](https://mochajs.org/) + [JSCoverage](https://github.com/fishbar/jscoverage) | ||
In mocha, if you've got your code instrumented for coverage, the command for a travis build would look something like this: | ||
Instrumenting your app for coverage is probably harder than it needs to be (read [here](http://seejohncode.com/2012/03/13/setting-up-mocha-jscoverage//)), but that's also a necessary step. | ||
In mocha, if you've got your code instrumented for coverage, the command for a Travis CI build would look something like this: | ||
```sh | ||
YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js | ||
``` | ||
Check out an example [Makefile](https://github.com/cainus/urlgrey/blob/master/Makefile) from one of my projects for an example, especially the test-coveralls build target. Note: Travis runs `npm test`, so whatever target you create in your Makefile must be the target that `npm test` runs (This is set in package.json's 'scripts' property). | ||
Check out an example [Makefile](https://github.com/cainus/urlgrey/blob/master/Makefile) from one of my projects for an example, especially the test-coveralls build target. Note: Travis CI runs `npm test`, so whatever target you create in your Makefile must be the target that `npm test` runs (This is set in package.json's `scripts` property). | ||
### [Istanbul](https://github.com/gotwarlost/istanbul) | ||
**With Mocha:** | ||
#### With Mocha: | ||
@@ -74,3 +98,3 @@ ```sh | ||
**With Jasmine:** | ||
#### With Jasmine: | ||
@@ -91,3 +115,3 @@ ```sh | ||
```javascript | ||
```json | ||
"scripts": { | ||
@@ -107,15 +131,18 @@ "test": "nodeunit test", | ||
For detailed instructions on requiring instrumented code, running on Travis and submitting to coveralls [see this guide](https://github.com/alanshaw/nodeunit-lcov-coveralls-example). | ||
For detailed instructions on requiring instrumented code, running on Travis CI and submitting to coveralls [see this guide](https://github.com/alanshaw/nodeunit-lcov-coveralls-example). | ||
### [Poncho](https://github.com/deepsweet/poncho) | ||
Client-side JS code coverage using [PhantomJS](https://github.com/ariya/phantomjs), [Mocha](http://mochajs.org/) and [Blanket](https://github.com/alex-seville/blanket): | ||
- [Configure](http://mochajs.org/#running-mocha-in-the-browser) Mocha for browser | ||
- [Mark](https://github.com/deepsweet/poncho#usage) target script(s) with `data-cover` html-attribute | ||
Client-side JS code coverage using [PhantomJS](https://github.com/ariya/phantomjs), [Mocha](https://mochajs.org/) and [Blanket](https://github.com/alex-seville/blanket): | ||
- [Configure](https://mochajs.org/#running-mocha-in-the-browser) Mocha for browser | ||
- [Mark](https://github.com/deepsweet/poncho#usage) target script(s) with `data-cover` HTML attribute | ||
- Run your tests with a command like this: | ||
```sh | ||
./node_modules/.bin/poncho -R lcov test/test.html | ./node_modules/coveralls/bin/coveralls.js | ||
``` | ||
```sh | ||
./node_modules/.bin/poncho -R lcov test/test.html | ./node_modules/coveralls/bin/coveralls.js | ||
``` | ||
### [Lab](https://github.com/hapijs/lab) | ||
```sh | ||
@@ -125,8 +152,8 @@ lab -r lcov | ./node_modules/.bin/coveralls | ||
### [nyc](https://github.com/bcoe/nyc) | ||
### [nyc](https://github.com/istanbuljs/nyc) | ||
works with almost any testing framework. Simply execute | ||
Works with almost any testing framework. Simply execute | ||
`npm test` with the `nyc` bin followed by running its reporter: | ||
``` | ||
```shell | ||
nyc npm test && nyc report --reporter=text-lcov | coveralls | ||
@@ -142,16 +169,25 @@ ``` | ||
### Command Line Parameters | ||
```shell | ||
Usage: coveralls.js [-v] filepath | ||
``` | ||
#### Optional arguments: | ||
-v, --verbose | ||
- `-v`, `--verbose` | ||
- `filepath` - optionally defines the base filepath of your source files. | ||
filepath - optionally defines the base filepath of your source files. | ||
## Running locally | ||
If you're running locally, you must have a `.coveralls.yml` file, as documented in [their documentation](https://coveralls.io/docs/ruby), with your `repo_token` in it; or, you must provide a `COVERALLS_REPO_TOKEN` environment-variable on the command-line. | ||
If you're running locally, you must have a `.coveralls.yml` file, as documented in [their documentation](https://docs.coveralls.io/ruby-on-rails#configuration), with your `repo_token` in it; or, you must provide a `COVERALLS_REPO_TOKEN` environment variable on the command-line. | ||
If you want to send commit data to coveralls, you can set the `COVERALLS_GIT_COMMIT` environment-variable to the commit hash you wish to reference. If you don't want to use a hash, you can set it to `HEAD` to supply coveralls with the latest commit data. This requires git to be installed and executable on the current PATH. | ||
## Contributing | ||
I generally don't accept pull requests that are untested, or break the build, because I'd like to keep the quality high (this is a coverage tool after all!). | ||
I also don't care for "soft-versioning" or "optimistic versioning" (dependencies that have ^, x, > in them, or anything other than numbers and dots). There have been too many problems with bad semantic versioning in dependencies, and I'd rather have a solid library than a bleeding edge one. | ||
[ci-image]: https://github.com/nickmerwin/node-coveralls/workflows/Tests/badge.svg | ||
@@ -162,7 +198,1 @@ [ci-url]: https://github.com/nickmerwin/node-coveralls/actions?workflow=Tests | ||
[coveralls-url]: https://coveralls.io/github/nickmerwin/node-coveralls?branch=master | ||
## Contributing | ||
I generally don't accept pull requests that are untested, or break the build, because I'd like to keep the quality high (this is a coverage tool afterall!). | ||
I also don't care for "soft-versioning" or "optimistic versioning" (dependencies that have ^, x, > in them, or anything other than numbers and dots). There have been too many problems with bad semantic versioning in dependencies, and I'd rather have a solid library than a bleeding edge one. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5
6
191
1
30262
583
93
- Removedcobertura-parse@^1.0.5
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbrowser-stdout@1.3.1(transitive)
- Removedcobertura-parse@1.0.5(transitive)
- Removedcommander@2.11.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddebug@3.1.0(transitive)
- Removeddiff@3.5.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.1.2(transitive)
- Removedgrowl@1.10.3(transitive)
- Removedhas-flag@2.0.0(transitive)
- Removedhe@1.1.1(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@0.0.8(transitive)
- Removedmkdirp@0.5.1(transitive)
- Removedmocha@5.0.5(transitive)
- Removedms@2.0.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedsax@1.4.1(transitive)
- Removedsupports-color@4.4.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedxml2js@0.4.19(transitive)
- Removedxmlbuilder@9.0.7(transitive)