I am testing a function that returns a promise. I want to assert that, in certain conditions, the returned promise would never settle (doesn't resolve nor reject).
How can I test this with Mocha?
If I run the following:
describe('under certain conditions', function () {
let promise;
beforeEach(function () {
promise = new Promise((resolve, reject) => {});
});
it('should hang forever', function () {
return promise;
});
});
I get the following error:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves