Here's the situation: I'm a complete n00b at Node.js and I'm working on my first package. The repo is set up on GitHub, I've created some working tests with Mocha, and I've also added it to Travis CI. Just now, I struck upon the code to use Istanbul through Mocha.
The problem is that though I've been trying all day to set up a system that communicates the Istanbul data to Coveralls.io, I just can't figure it out. I've tried using the node-coveralls package, which gives this example script:
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
However, as I'm on a Windows computer, I don't have the cat
command. As I'm also a complete n00b at writing scripts, I googled and experimented for an hour and came up with this:
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && ./coverage/lcov.info > ./node_modules/coveralls/bin/coveralls.js 2>&1 && rm -rf ./coverage
I'm not exactly sure whether this pipes the output to coveralls.js
or if it appends the output instead. It didn't error, so I tried pushing it, but it failed every Node version on Travis CI.
Also, the Coveralls page for my repo is still on the "Set up Coveralls for Ruby + Travis CI" page. I've created a .coveralls.yml
file, but it's currently empty. So I guess I have two questions:
- How can I set up a system on Windows for piping Istanbul data to node-coveralls?
- Do I need to put my repo token in the
.coveralls.yml
file for it to register? I'm pretty sure I don't, because Coveralls stresses keeping tokens private.
If there's a basic Node package hosted on GitHub that uses Mocha + Istanbul + Coveralls, I'd love to just be able to look at how that's set up.
One more thing: I'm not sure where exactly in the repo I need to put the script. Does it go in the after-success
section in .travis.yml
?