diff options
| author | elliottcable <[email protected]> | 2013-05-24 02:54:37 -0400 |
|---|---|---|
| committer | elliottcable <[email protected]> | 2013-05-24 02:54:37 -0400 |
| commit | ebca6c04edd9952c1c3fb99aea019e385a4c53b8 (patch) | |
| tree | 22b8116ee64fb5335076aae87cb074433e145ae4 | |
| parent | 92783b483630b516b83cab3b555cce2fb5b79982 (diff) | |
| download | node-coveralls-ebca6c04edd9952c1c3fb99aea019e385a4c53b8.tar.xz node-coveralls-ebca6c04edd9952c1c3fb99aea019e385a4c53b8.zip | |
Supporting the COVERALLS_REPO_TOKEN environment-variable
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | bin/coveralls.js | 10 |
2 files changed, 8 insertions, 4 deletions
@@ -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){ |
