nyc mocha help needed
See original GitHub issueHello,
I have an issue that I cannot resolve without your help.
I am running mocha tests using chai asserts. When I run the test file using mocha, e.g: mocha test/cli-commands/coverage/coverage.js
The tests are running OK.
When I use
nyc --check-coverage --lines 95 mocha 'test/**/*.js' --require mocha.opts.helper.js
All the test are failing due to timeout or something else that I don’t understand.
What is the difference when I run the command with nyc and without nyc.
Do you have some special timeout that I can specify ?
Thank you.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
NodeJs: testing with Mocha and code coverage with nyc
Here is a fun and easy way to carry out test. Mocha, a javascript test framework. So istanbul/nyc is a code coverage tool...
Read more >Using Istanbul With Mocha
Istanbul is extensively tested with mocha, which we use for many of our own repos. At the end of the day, all you...
Read more >Mocha Code Coverage: How to Use Istanbul to Get Going
Today we're going to cover everything you need to know about getting set up with Mocha code coverage using a tool called Istanbul....
Read more >node.js - No coverage nyc mocha - Stack Overflow
I have installed mocha globally and when nyc referring mocha globally it does't show anything in the coverage report.
Read more >9 - Coverage report (using istanbul's nyc package) | Mocha
This is the 9th video tutorial of this web series on Mocha - Javascript unit testing framework. In this tutorial, you will learn...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

nyc adds instrumentation (hit counters) to your code so this could make the code take slightly longer than before. nyc does not impose timeout’s, this would be mocha. Possibly your timeouts are set with little margin of error and the instrumented code takes just too long.
That is all anyone can say without a minimal repository showing a reproduction.
Hi @ochikov can you please tell me how you overcame global window object issue while using nyc? I am facing the similar problem where my test cases are running with mocha but when I am using nyc with mocha, test cases are failing. I am using global window object.