codacy-coverage
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -6,3 +6,3 @@ (function (parser, reporter, getGitData, logger, Promise, util) { | ||
var token = opts.token || process.env.CODACY_REPO_TOKEN; | ||
var token = opts.token || process.env.CODACY_PROJECT_TOKEN || process.env.CODACY_REPO_TOKEN; | ||
var commit = opts.commit; | ||
@@ -9,0 +9,0 @@ var format = opts.format || 'lcov'; |
@@ -5,3 +5,3 @@ (function (request, Joi, Promise, util, logger) { | ||
var optionsValidation = Joi.object({ | ||
endpoint: Joi.string().min(1).optional().example('https://codacy.com/api/2.0/coverage/:commitId/:language') | ||
endpoint: Joi.string().min(1).optional().example('https://api.codacy.com/2.0/coverage/:commitId/:language') | ||
}); | ||
@@ -30,3 +30,3 @@ var tokenValidation = Joi.string().required().min(1).example('1234567890');//TODO: Revisit this validation to see if we can better validate the values | ||
var endpoint = options.endpoint || 'https://www.codacy.com/api/2.0/coverage/:commitId/javascript'; | ||
var endpoint = options.endpoint || 'https://api.codacy.com/2.0/coverage/:commitId/javascript'; | ||
logger.debug('Setting up reporter communicating to: ' + endpoint); | ||
@@ -33,0 +33,0 @@ |
{ | ||
"name": "codacy-coverage", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Code Coverage reporter for Codacy.com", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,3 +6,3 @@ # Codacy Coverage Reporter | ||
[![Build Status](https://travis-ci.org/codacy/node-codacy-coverage.svg?branch=1.0.0)](https://travis-ci.org/codacy/node-codacy-coverage) | ||
[![Build Status](https://circleci.com/gh/codacy/node-codacy-coverage.png?style=shield&circle-token=:circle-token)](https://circleci.com/gh/codacy/node-codacy-coverage) | ||
[![npm](https://img.shields.io/npm/v/codacy-coverage.svg)](https://www.npmjs.com/package/codacy-coverage) | ||
@@ -28,10 +28,10 @@ [![npm](https://img.shields.io/npm/dm/codacy-coverage.svg)](https://www.npmjs.com/package/codacy-coverage) | ||
This script ( `bin/codacy-coverage.js` ) can take standard input from any tool that emits the lcov data format (including [mocha](http://visionmedia.github.com/mocha/)'s [LCov reporter](https://npmjs.org/package/mocha-lcov-reporter)) and send it to Codacy to report your code coverage there. | ||
This script ( `bin/codacy-coverage.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 Codacy 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/codacy-coverage/bin/codacy-coverage.js`. | ||
Once your app is instrumented for coverage, and building, you need to pipe the lcov output to `./node_modules/.bin/codacy-coverage`. | ||
You'll need to provide the Report token from Codacy via an environment variable: | ||
* CODACY_REPO_TOKEN (the secret repo token from Codacy.com) | ||
* CODACY_PROJECT_TOKEN (the secret repo token from Codacy.com) | ||
### [Mocha](http://visionmedia.github.io/mocha/) + [Blanket.js](https://github.com/alex-seville/blanket) | ||
### [Mocha](http://mochjajs.org) + [Blanket.js](https://github.com/alex-seville/blanket) | ||
- Install [blanket.js](http://blanketjs.org/) | ||
@@ -44,5 +44,5 @@ - Configure blanket according to [docs](https://github.com/alex-seville/blanket/blob/master/docs/getting_started_node.md). | ||
--require blanket \ | ||
--reporter mocha-lcov-reporter | ./node_modules/codacy-coverage/bin/codacy-coverage.js | ||
--reporter mocha-lcov-reporter | ./node_modules/.bin/codacy-coverage | ||
``` | ||
### [Mocha](http://visionmedia.github.io/mocha/) + [JSCoverage](https://github.com/fishbar/jscoverage) | ||
### [Mocha](http://mochajs.org) + [JSCoverage](https://github.com/fishbar/jscoverage) | ||
@@ -53,3 +53,3 @@ 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. | ||
```sh | ||
YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/codacy-coverage/bin/codacy-coverage.js | ||
YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/.bin/codacy-coverage | ||
``` | ||
@@ -61,3 +61,3 @@ ### [Istanbul](https://github.com/gotwarlost/istanbul) | ||
```sh | ||
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/codacy-coverage/bin/codacy-coverage.js && rm -rf ./coverage | ||
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/.bin/codacy-coverage && rm -rf ./coverage | ||
``` | ||
@@ -68,3 +68,3 @@ | ||
```sh | ||
istanbul cover jasmine-node --captureExceptions spec/ && cat ./coverage/lcov.info | ./node_modules/codacy-coverage/bin/codacy-coverage.js && rm -rf ./coverage | ||
istanbul cover jasmine-node --captureExceptions spec/ && cat ./coverage/lcov.info | ./node_modules/.bin/codacy-coverage && rm -rf ./coverage | ||
``` | ||
@@ -76,4 +76,4 @@ | ||
### [Poncho](https://github.com/deepsweet/poncho) | ||
Client-side JS code coverage using [PhantomJS](https://github.com/ariya/phantomjs), [Mocha](https://github.com/visionmedia/mocha) and [Blanket](https://github.com/alex-seville/blanket): | ||
- [Configure](http://visionmedia.github.io/mocha/#browser-support) Mocha for browser | ||
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#browser-support) Mocha for browser | ||
- [Mark](https://github.com/deepsweet/poncho#usage) target script(s) with `data-cover` html-attribute | ||
@@ -83,3 +83,3 @@ - Run your tests with a command like this: | ||
```sh | ||
./node_modules/.bin/poncho -R lcov test/test.html | ./node_modules/codacy-coverage/bin/codacy-coverage.js | ||
./node_modules/.bin/poncho -R lcov test/test.html | ./node_modules/.bin/codacy-coverage | ||
``` | ||
@@ -86,0 +86,0 @@ |
@@ -6,3 +6,3 @@ (function (handleInput, helper, Joi, request, fs, path) { | ||
var lcovData = fs.readFileSync(__dirname + '/mock/lcov.info').toString(); | ||
var originalCodacyToken = process.env.CODACY_REPO_TOKEN; | ||
var originalCodacyToken = process.env.CODACY_PROJECT_TOKEN || process.env.CODACY_REPO_TOKEN; | ||
@@ -12,3 +12,3 @@ describe('Handle Input', function () { | ||
helper.clearEnvironmentVariables(); | ||
process.env.CODACY_REPO_TOKEN = originalCodacyToken; | ||
process.env.CODACY_PROJECT_TOKEN = originalCodacyToken; | ||
}); | ||
@@ -45,3 +45,3 @@ it('should be able to use the mock end-point', function () { | ||
return expect(request({ | ||
url: 'https://www.codacy.com/api/2.0/coverage/4321/javascript', | ||
url: 'https://api.codacy.com/2.0/coverage/4321/javascript', | ||
method: 'POST', | ||
@@ -144,3 +144,3 @@ json: sampleCoverageData, | ||
it('shouldn\'t be able to send coverage with invalid input', function () { | ||
process.env.CODACY_REPO_TOKEN = ''; | ||
process.env.CODACY_PROJECT_TOKEN = ''; | ||
return expect(handleInput()).to.eventually.be.rejectedWith(Error, 'Token is required'); | ||
@@ -147,0 +147,0 @@ }); |
@@ -19,4 +19,4 @@ (function (nock, chai, Promise) { | ||
return resolve(nock('https://www.codacy.com') | ||
.post('/api/2.0/coverage/' + commitId + '/javascript', function (body) { | ||
return resolve(nock('https://api.codacy.com') | ||
.post('/2.0/coverage/' + commitId + '/javascript', function (body) { | ||
var result = bodyValidator.validate(body); | ||
@@ -23,0 +23,0 @@ return result.error ? false : true; |
@@ -42,3 +42,3 @@ (function (Joi, request, reporter, helper) { | ||
return expect(request({ | ||
url: 'https://www.codacy.com/api/2.0/coverage/4321/javascript', | ||
url: 'https://api.codacy.com/2.0/coverage/4321/javascript', | ||
method: 'POST', | ||
@@ -45,0 +45,0 @@ json: sampleCoverageData, |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
51807
40