Fail correct test for Promise

This commit is contained in:
Winnie Hellmann 2019-03-25 21:32:48 +01:00
parent 0b68b17c3b
commit 0e9c092d00
1 changed files with 7 additions and 4 deletions

View File

@ -5,10 +5,13 @@ import { initializeTestTimeout } from './helpers/timeout';
process.on('unhandledRejection', global.promiseRejectionHandler);
// wait for pending setTimeout()s
afterEach(() => {
jest.runAllTimers();
});
afterEach(() =>
// give Promises a bit more time so they fail the right test
new Promise(setImmediate).then(() => {
// wait for pending setTimeout()s
jest.runAllTimers();
}),
);
initializeTestTimeout(300);