I have a code where certain tests will always fail in CI environment. I would like to disable them based on an environment condition. How to programmatically skip a...
If we have a unit test file my-spec.js and running with mocha: mocha my-spec.js The default timeout will be 2000 ms. It can be overwritten for partial test with...
I’m trying to figure out on how to test internal (i.e. not exported) functions in nodejs (preferably with mocha or jasmine). And i have no idea! Let say I...
In my node application I’m using mocha to test my code. While calling many asynchronous functions using mocha, I’m getting timeout error (Error: timeout of 2000ms exceeded.). How can...
Mocha tries to find test files under test by default, how do I specify another dir, e.g. server-test? 15 Answers 15
Why does the following fail? expect([0,0]).to.equal(...
I’m having issues getting Chai’s expect.to.throw to work in a test for my node.js app. The test keeps failing on the thrown error, but If I wrap the test...
I am using Mocha for testing my NodeJS application. I am not able to figure out how to use its code coverage feature. I tried googling it but did...
I use Mocha to test my JavaScript stuff. My test file contains 5 tests. Is that possible to run a specific test (or set of tests) rather than all...
I’m submitting a network request in a test case, but this sometimes takes longer than 2 seconds (the default timeout). How do I increase the timeout for a single...