gitlab-org--gitlab-foss/spec/frontend/test_setup.js

17 lines
399 B
JavaScript
Raw Normal View History

2018-12-10 12:42:25 +00:00
const testTimeoutInMs = 300;
2018-09-06 17:36:04 +00:00
jest.setTimeout(testTimeoutInMs);
let testStartTime;
// https://github.com/facebook/jest/issues/6947
beforeEach(() => {
testStartTime = Date.now();
});
afterEach(() => {
const elapsedTimeInMs = Date.now() - testStartTime;
if (elapsedTimeInMs > testTimeoutInMs) {
throw new Error(`Test took too long (${elapsedTimeInMs}ms > ${testTimeoutInMs}ms)!`);
}
});