summaryrefslogtreecommitdiff
path: root/spec/frontend/helpers/timeout.js
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2019-06-07 10:57:35 +0100
committerFilipa Lacerda <filipa@gitlab.com>2019-06-07 10:57:35 +0100
commiteb9632aab2f027393ab34158453114fd281e4d55 (patch)
treee9047cb60db1092a1e1a0cdf1c9759b3bb753156 /spec/frontend/helpers/timeout.js
parent399085d6f5f0bbbd61f1286a93e76aa2371f9143 (diff)
parentfd19f887dfeeeedb483c4a4fb32f9f768e89389c (diff)
downloadgitlab-ce-62788-graphql-pagination.tar.gz
Merge branch 'master' into 62788-graphql-pagination62788-graphql-pagination
* master: (61 commits) Add dependency list documentation added code differences from EE to CE Remove metrics_time_window feature flag SSoT audit fixes Integrate demo link into content more Add styles and animations for onboarding helper Add git 2.21 install from update_source IDE trigger files change event Remove 'build-page' from 'ide-terminal' element Add section to dev docs on accessing chatops Fix OpenID Connect documentation Make OpenID Connect work without requiring a name Apply reviewer feedback Change text to match screencaps Reword for clarity Upgrade jira user permissions workflow docs Fix some typoes Removes duplicated shared_context folder Add frontend support for cluster health alerts Add changelog entry for sidekiq metrics ...
Diffstat (limited to 'spec/frontend/helpers/timeout.js')
-rw-r--r--spec/frontend/helpers/timeout.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/frontend/helpers/timeout.js b/spec/frontend/helpers/timeout.js
index e74598ae20a..702ef0be5aa 100644
--- a/spec/frontend/helpers/timeout.js
+++ b/spec/frontend/helpers/timeout.js
@@ -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 => {