Skip to content
This repository was archived by the owner on Dec 8, 2024. It is now read-only.

Coverage is incorrect with nodeunit #229

Open
ecokeley opened this issue Jul 29, 2014 · 3 comments
Open

Coverage is incorrect with nodeunit #229

ecokeley opened this issue Jul 29, 2014 · 3 comments

Comments

@ecokeley
Copy link

All my unit tests are passing with nodeunit and my tests are executing ever line of my 1 module I'm testing. Coverage seems to only count 1 test.

I validated by putting console.logs in code and tests to prove lines were executed.

@ecokeley
Copy link
Author

I think because I'm using nodeunits util Sandbox to replace require I am only getting the test that isn't mocking out other modules. I see in the configuration there are hooks but it isn't clear how I could use them.

@gotwarlost
Copy link
Owner

Yeah - there is no good way to do coverage in the nodeunit sandbox because istanbul relies on global variables to collect coverage. Need to dig deeper since I did notice that there is a way to pass some globals into the nodeunit sandbox.

@dciccale
Copy link

dciccale commented Aug 3, 2015

hi, i'm having a similar issue.. here are my nodeunit tests https://github.com/dciccale/node-htmlprocessor/blob/0.2.0/test/test.js

and if i run

$ istanbul cover npm test

tests do run, but i get

OK: 15 assertions (85ms)
No coverage information was collected, exit without writing coverage information

I have migrated to my tests to mocha

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants