Skip to content
Advertisement

Tag: mocha.js

Why do these sinon stubs resolve to undefined?

I’ve written a unit test for the following code and stubbed the browser methods (read: web-extension API) using Sinon (more specifically: sinon-chrome, a dated but still functioning library for my use case). The unit test: The tests fail due to both the stubbed methods returning undefined, but the Sinon docs state quite clearly that stub.resolves(value): Causes the stub to return

Change default timeout for mocha

If we have a unit test file my-spec.js and running with mocha: The default timeout will be 2000 ms. It can be overwritten for partial test with a command line parameter: Is it possible to change the default timeout globally for all tests? i.e. the default timeout value will be different from 2000 ms when you call: Answer By default

Advertisement