0

I have compoundjs application in which I have used the scaffold generator to generate controller and its test cases. The test cases are running correctly. But I need to generate the code coverage report for the same. I am trying to use blanket.js for the same.

I have configured blanket.js like this in package.json in scripts :

"blanket": { "pattern": "app" }

app is the folder which contains all my controllers, models etc. And then I am running test cases having reporter as :

mocha test/init.js test/controllers/sample_controller.test.js --require blanket -R html-cov > coverage.html

This is actually properly generating coverage report for it. But the problem I am facing is it is only showing the code coverage for certain files like it is showing code coverage for model/sample but not for controllers/sample_controller.js.

Please help me out ASAP as I am actually stuck with it. Thanks a lot in advance,

Unni Kris
  • 3,081
  • 4
  • 35
  • 57

2 Answers2

0

Option 1: Try using _mocha instead of mocha to avoid mocha forking and not covering all of your code in the same process.

Option 2: I highly recommend istanbul as a coverage tool. Try:

npm -g install istanbul
istanbul cover _mocha -- test/init.js test/controllers/sample_controller.test.js --require blanket -R spec
open coverage/lcov-report/index.html

More info here: https://github.com/gotwarlost/istanbul/issues/44

Dan Kohn
  • 33,811
  • 9
  • 84
  • 100
0

These are eval controllers, right? I'm investigate coverage for eval controllers in the next release of Blanket (v1.1.3). In the meantime Istanbul is an option, as is grunt-blanket.

Alex Seville
  • 178
  • 1
  • 2
  • 8