I'm using mocha to run tests that are purely in coffeescript. I also want to be able to use istanbul to generate code coverage reports.
Note, I'm using mocha with option --compilers coffee:coffee-script/register
within the mocha.opts
file.
The issue I'm running into is that tests that require other coffeescript source files aren't covered. If instead, I require js files, it's covered fine.
Am I missing something?
My npm test
command is: istanbul test --report html -x 'vendor/**' _mocha
. I use npm test --coverage
to enforce istanbul's coverage utility.
Here is a sample of a mocha test (./test/test.coffee):
# Project
# require ../src/main.coffee
main = require('../src/main')
# Chai
chai = require('chai')
assert = chai.assert
should = chai.should()
expect = chai.expect
describe 'something', (done) ->
describe "when given something", ->
it "should do this", ->
# tests using chai API here
something = new main()
I use coffee-coverage instead with these instructions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With