Top "Mocha" questions

Mocha.

How to authenticate Supertest requests with Passport?

I'm using Passport.js for authentication (local strategy) and testing with Mocha and Supertest. How can I create a session …

node.js mocha supertest passport.js
How can you use cookies with superagent?

I'm doing cookie session management with express with something like this: req.session.authentication = auth; And I verify the authenticated …

node.js mocha superagent
How to Unit Test React-Redux Connected Components?

I am using Mocha, Chai, Karma, Sinon, Webpack for Unit tests. I followed this link to configure my testing environment …

unit-testing reactjs mocha sinon redux
How to suppress application logging messages from a node.js application when running unit tests?

While unit-testing my node.js application (which is basically a REST backend) using mocha and supertest, I need only the …

node.js unit-testing mocha
Stubbing window.location.href with Sinon

I am trying to test some client-side code and for that I need to stub the value of window.location.…

javascript mocha sinon stubbing
Verify that an exception is thrown using Mocha / Chai and async/await

I'm struggling to work out the best way to verify that a promise is rejected in a Mocha test while …

node.js async-await mocha chai chai-as-promised
What's the best way to unit test an event being emitted in Nodejs?

I'm writing a bunch of mocha tests and I'd like to test that particular events are emitted. Currently, I'm doing …

javascript node.js mocha
Testing JS exceptions with Mocha/Chai

Trying to test some code that throws an exception with Mocha/Chai, but having no luck, here's the simple code …

javascript coffeescript mocha chai
How to run mocha and mocha-phantomjs tests from one "npm test" command in node.js?

I have got few node packages which works in node.js environment and also in browser. Now I have got …

node.js testing browser phantomjs mocha
Testing requests that redirect with mocha/supertest in node

I can't seem to get the following integration test to pass in an express project using mocha, supertest, and should (…

node.js express mocha supertest