Commit 2fe47c10 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'winh-increase-jest-timeout-ci' into 'master'

Increase Jest timeout on CI to 5 seconds

Closes #62855, #61905, and #61235

See merge request gitlab-org/gitlab-ce!29278
parents 70a717da 7100c6b5
......@@ -5,7 +5,13 @@ const IS_DEBUGGING = process.execArgv.join(' ').includes('--inspect-brk');
let testTimeoutNS;
export const setTestTimeout = newTimeoutMS => {
testTimeoutNS = newTimeoutMS * NS_PER_MS;
const newTimeoutNS = newTimeoutMS * NS_PER_MS;
// never accept a smaller timeout than the default
if (newTimeoutNS < testTimeoutNS) {
return;
}
testTimeoutNS = newTimeoutNS;
jest.setTimeout(newTimeoutMS);
};
......@@ -13,7 +19,13 @@ export const setTestTimeout = newTimeoutMS => {
// Useful for tests with jQuery, which is very slow in big DOMs.
let temporaryTimeoutNS = null;
export const setTestTimeoutOnce = newTimeoutMS => {
temporaryTimeoutNS = newTimeoutMS * NS_PER_MS;
const newTimeoutNS = newTimeoutMS * NS_PER_MS;
// never accept a smaller timeout than the default
if (newTimeoutNS < testTimeoutNS) {
return;
}
temporaryTimeoutNS = newTimeoutNS;
};
export const initializeTestTimeout = defaultTimeoutMS => {
......
......@@ -15,7 +15,7 @@ afterEach(() =>
}),
);
initializeTestTimeout(500);
initializeTestTimeout(process.env.CI ? 5000 : 500);
// fail tests for unmocked requests
beforeEach(done => {
......
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