aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xbin/coveralls.js10
2 files changed, 8 insertions, 4 deletions
diff --git a/README.md b/README.md
index 4f41665..e484a36 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ In mocha, if you've got your code instrumented for coverage, the command for a t
YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js
```
-If you're running locally, you must have a `.coveralls.yml` file, as documented in their documentation, with your `repo_token` in it.
+If you're running locally, you must have a `.coveralls.yml` file, as documented in their documentation, with your `repo_token` in it; or, you must provide a `COVERALLS_REPO_TOKEN` environment-variable on the command-line.
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).
diff --git a/bin/coveralls.js b/bin/coveralls.js
index d3d18e1..42503bb 100755
--- a/bin/coveralls.js
+++ b/bin/coveralls.js
@@ -22,9 +22,13 @@ var inputToCoveralls = function(input){
console.log(input);
var libDir = process.argv[2] || '';
- var yml = path.join(process.cwd(), '.coveralls.yml');
- if (fs.statSync(yml).isFile()) {
- repo_token = YAML.readFileSync(yml)[0]['repo_token'];
+ if (process.env['COVERALLS_REPO_TOKEN'] != null) {
+ repo_token = process.env['COVERALLS_REPO_TOKEN'];
+ } else {
+ var yml = path.join(process.cwd(), '.coveralls.yml');
+ if (fs.statSync(yml).isFile()) {
+ repo_token = YAML.readFileSync(yml)[0]['repo_token'];
+ }
}
convertLcovToCoveralls(input, libDir, repo_token, function(err, postData){