2019-05-30 16:15:17 +05:30
|
|
|
const testTimeoutInMs = 300;
|
|
|
|
jest.setTimeout(testTimeoutInMs);
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-05-30 16:15:17 +05:30
|
|
|
let testStartTime;
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-05-30 16:15:17 +05:30
|
|
|
// https://github.com/facebook/jest/issues/6947
|
|
|
|
beforeEach(() => {
|
|
|
|
testStartTime = Date.now();
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
2019-05-30 16:15:17 +05:30
|
|
|
afterEach(() => {
|
|
|
|
const elapsedTimeInMs = Date.now() - testStartTime;
|
|
|
|
if (elapsedTimeInMs > testTimeoutInMs) {
|
|
|
|
throw new Error(`Test took too long (${elapsedTimeInMs}ms > ${testTimeoutInMs}ms)!`);
|
|
|
|
}
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|