Commit fac4d54f authored by Winnie Hellmann's avatar Winnie Hellmann

Fail long running tests

parent ca3603de
......@@ -24,4 +24,5 @@ module.exports = {
cacheDirectory: '<rootDir>/tmp/cache/jest',
modulePathIgnorePatterns: ['<rootDir>/.yarn-cache/'],
reporters,
setupTestFrameworkScriptFile: '<rootDir>/spec/frontend/test_setup.js',
};
const testTimeoutInMs = 0;
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)!`);
}
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment