I have an app (https://github.com/idmillington/dendry) that uses Travis CI to monitor build status. I use Istanbul to general a coverage report, and I'd like to send this to Coveralls, to generate a coverage button for the README.
All of this I can get working. But...
When I run npm test
locally, I don't want to send coveralls the coverage data. I'm typically running npm test
dozens of times for each commit. But when I push and Travis does its thing, I'd like Travis to update the coverage for me.
I could have something like this in my package.json:
"scripts": {
"test": "./node_modules/.bin/istanbul test ./node_modules/.bin/_mocha",
}
Which is fine for locally, and doesn't update Coveralls, but Travis won't update Coveralls either. Or I could do:
"scripts": {
"test": "./node_modules/.bin/istanbul test ./node_modules/.bin/_mocha && ./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info",
}
Which is perfect for Travis, but tries to push data to Coveralls every time I run npm test
locally.
As far as I can tell, I can't ask Travis to run something other than npm test
.
I am unwilling to ask any potential users or contributors to remember to test using
$ npm run-script test-local
or some such, especially as running npm test
would generate an upload error without the correct private key for coveralls.
Is there a way to get the right behavior here?