Commit 7100c6b5 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Phil Hughes

Increase Jest timeout on CI to 5 seconds

parent 70a717da
...@@ -5,7 +5,13 @@ const IS_DEBUGGING = process.execArgv.join(' ').includes('--inspect-brk'); ...@@ -5,7 +5,13 @@ const IS_DEBUGGING = process.execArgv.join(' ').includes('--inspect-brk');
let testTimeoutNS; let testTimeoutNS;
export const setTestTimeout = newTimeoutMS => { 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); jest.setTimeout(newTimeoutMS);
}; };
...@@ -13,7 +19,13 @@ export const setTestTimeout = newTimeoutMS => { ...@@ -13,7 +19,13 @@ export const setTestTimeout = newTimeoutMS => {
// Useful for tests with jQuery, which is very slow in big DOMs. // Useful for tests with jQuery, which is very slow in big DOMs.
let temporaryTimeoutNS = null; let temporaryTimeoutNS = null;
export const setTestTimeoutOnce = newTimeoutMS => { 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 => { export const initializeTestTimeout = defaultTimeoutMS => {
......
...@@ -15,7 +15,7 @@ afterEach(() => ...@@ -15,7 +15,7 @@ afterEach(() =>
}), }),
); );
initializeTestTimeout(500); initializeTestTimeout(process.env.CI ? 5000 : 500);
// fail tests for unmocked requests // fail tests for unmocked requests
beforeEach(done => { 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