mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-13 13:31:19 +00:00
Fail long running tests
This commit is contained in:
@ -24,4 +24,5 @@ module.exports = {
|
|||||||
cacheDirectory: '<rootDir>/tmp/cache/jest',
|
cacheDirectory: '<rootDir>/tmp/cache/jest',
|
||||||
modulePathIgnorePatterns: ['<rootDir>/.yarn-cache/'],
|
modulePathIgnorePatterns: ['<rootDir>/.yarn-cache/'],
|
||||||
reporters,
|
reporters,
|
||||||
|
setupTestFrameworkScriptFile: '<rootDir>/spec/frontend/test_setup.js',
|
||||||
};
|
};
|
||||||
|
16
spec/frontend/test_setup.js
Normal file
16
spec/frontend/test_setup.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
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)!`);
|
||||||
|
}
|
||||||
|
});
|
Reference in New Issue
Block a user