chai-as-promised does not work with Promise.delay API of bluebird.
Mocha will give me timeout error:
test
1) should work
0 passing (5s)
1 failing
1) test
should work:
Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/ldu020/workspace/github.com/mrdulin/expressjs-research/src/stackoverflow/35381245-todo/index.test.js)
If I create my own Promise.delay method with native promise, it works fine with chai-as-promised and sinon.useFakeTimers().
But, if I use the Promise.delay method of bluebird, it won't work. No matter whether you use const Promise = require('bluebird'); or global.Promise = require('bluebird');, both of them do not work
Related issue: https://github.com/domenic/chai-as-promised/issues/169
chai-as-promised
does not work with Promise.delay API of bluebird.Mocha will give me timeout error:
Here is a minimal, reproducibe example:
If I create my own
Promise.delay
method with native promise, it works fine withchai-as-promised
andsinon.useFakeTimers()
.But, if I use the
Promise.delay
method ofbluebird
, it won't work. No matter whether you useconst Promise = require('bluebird');
orglobal.Promise = require('bluebird');
, both of them do not workEnvironment information:
v10.16.2