question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nyc mocha help needed

See original GitHub issue

Hello, 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:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
coreyfarrellcommented, Mar 25, 2019

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.

0reactions
catchashu10commented, Jun 2, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found