Comparing version 2.0.16 to 2.1.0
var dir = './lib/'; | ||
if (process.env.COVERALLS_COVERAGE){ | ||
dir = './lib-cov/'; | ||
} | ||
exports.convertLcovToCoveralls = require(dir + 'convertLcovToCoveralls'); | ||
@@ -6,0 +3,0 @@ exports.sendToCoveralls = require(dir + 'sendToCoveralls'); |
@@ -5,2 +5,3 @@ var fs = require('fs'); | ||
var logger = require('./logger')(); | ||
var git = require('./fetchGitData'); | ||
@@ -37,20 +38,16 @@ var getOptions = function(){ | ||
if (process.env.CIRCLECI){ | ||
options.service_name = 'circleci'; | ||
options.service_job_id = process.env.CIRCLE_BUILD_NUM; | ||
git_commit = process.env.CIRCLE_SHA1; | ||
git_branch = process.env.CIRCLE_BRANCH; | ||
} | ||
if (git_commit){ | ||
options.git = { | ||
"head": { | ||
"id": git_commit, | ||
"author_name": "Unknown Author", | ||
"author_email": "", | ||
"committer_name": "Unknown Committer", | ||
"committer_email": "", | ||
"message": "Unknown Commit Message" | ||
options.git = git({ | ||
head: { | ||
id: git_commit | ||
}, | ||
"branch": git_branch /*, | ||
"remotes": [ | ||
{ | ||
"name": "origin", | ||
"url": "git@github.com:lemurheavy/coveralls-ruby.git" | ||
} | ||
]*/ | ||
}; | ||
branch: git_branch | ||
}); | ||
} | ||
@@ -57,0 +54,0 @@ |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "2.0.16", | ||
"version": "2.1.0", | ||
"bugs": { | ||
@@ -14,3 +14,7 @@ "url": "https://github.com/cainus/node-coveralls/issues" | ||
"scripts": { | ||
"test": "make test" | ||
"test": "make test", | ||
"blanket": { | ||
"pattern": "lib", | ||
"data-cover-never": "node_modules" | ||
} | ||
}, | ||
@@ -34,5 +38,7 @@ "bin": { | ||
"lcov-parse": "0.0.4", | ||
"log-driver": "1.2.1" | ||
"log-driver": "1.2.1", | ||
"exec-sync": "~0.1.6" | ||
}, | ||
"devDependencies": { | ||
"blanket": "~1.1.5", | ||
"sinon-restore": "1.0.0", | ||
@@ -42,3 +48,2 @@ "mocha-lcov-reporter": "0.0.1", | ||
"should": "1.1.0", | ||
"jscoverage": "0.3.7", | ||
"jshint": "2.1.3" | ||
@@ -45,0 +50,0 @@ }, |
@@ -34,3 +34,3 @@ #node-coveralls | ||
###[Blanket.js](https://github.com/alex-seville/blanket) | ||
### [Mocha](http://visionmedia.github.io/mocha/) + [Blanket.js](https://github.com/alex-seville/blanket) | ||
- Install [blanket.js](http://blanketjs.org/) | ||
@@ -45,3 +45,3 @@ - Configure blanket according to [docs](https://github.com/alex-seville/blanket/blob/master/docs/getting_started_node.md). | ||
``` | ||
###[JSCoverage](https://github.com/fishbar/jscoverage) | ||
### [Mocha](http://visionmedia.github.io/mocha/) + [JSCoverage](https://github.com/fishbar/jscoverage) | ||
@@ -51,3 +51,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/) or [here](http://tjholowaychuk.com/post/18175682663/mocha-test-coverage)), but that's also a necessary step. | ||
In mocha, if you've got your code instrumented for coverage, the command for a travis build would look something like this: | ||
```console | ||
```sh | ||
YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js | ||
@@ -57,5 +57,32 @@ ``` | ||
##[Istanbul](https://github.com/gotwarlost/istanbul) | ||
### [Istanbul](https://github.com/gotwarlost/istanbul) | ||
TODO | ||
### [Nodeunit](https://github.com/caolan/nodeunit) + [JSCoverage](https://github.com/fishbar/jscoverage) | ||
Depend on nodeunit, jscoverage and coveralls: | ||
```sh | ||
npm install nodeunit jscoverage coveralls --save-dev | ||
``` | ||
Add a coveralls script to "scripts" in your `package.json`: | ||
```javascript | ||
"scripts": { | ||
"test": "nodeunit test", | ||
"coveralls": "jscoverage lib && YOURPACKAGE_COVERAGE=1 nodeunit --reporter=lcov test | coveralls" | ||
} | ||
``` | ||
Ensure your app requires instrumented code when `process.env.YOURPACKAGE_COVERAGE` variable is defined. | ||
Run your tests with a command like this: | ||
```sh | ||
npm run coveralls | ||
``` | ||
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). | ||
## Running locally | ||
@@ -65,2 +92,4 @@ | ||
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. | ||
@@ -11,3 +11,3 @@ var should = require('should'); | ||
getOptions().filepath.should.equal("somepath"); | ||
}); | ||
@@ -61,5 +61,23 @@ it ("should get a filepath if there is one, even in verbose mode", function(){ | ||
message: 'Unknown Commit Message' }, | ||
branch: 'master' }); | ||
branch: 'master', | ||
remotes: [] }); | ||
}); | ||
it ("should set service_name and service_job_id if it's running on circleci", function(){ | ||
process.env.CIRCLECI = true; | ||
process.env.CIRCLE_BRANCH = "master"; | ||
process.env.CIRCLE_BUILD_NUM = "1234"; | ||
process.env.CIRCLE_SHA1 = "e3e3e3e3e3e3e3e3e"; | ||
var options = getOptions(); | ||
options.service_name.should.equal("circleci"); | ||
options.service_job_id.should.equal("1234"); | ||
options.git.should.eql({ head: | ||
{ id: 'e3e3e3e3e3e3e3e3e', | ||
author_name: 'Unknown Author', | ||
author_email: '', | ||
committer_name: 'Unknown Committer', | ||
committer_email: '', | ||
message: 'Unknown Commit Message' }, | ||
branch: 'master', | ||
remotes: [] }); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
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
190118
23
6430
91
5
57
+ Addedexec-sync@~0.1.6
+ Addedexec-sync@0.1.6(transitive)