summaryrefslogtreecommitdiff
path: root/spec/frontend/helpers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-19 15:08:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-19 15:08:39 +0000
commite1f8f12bbed19bea753d81d7586b30ea403733d5 (patch)
tree379d8f092fa416eb1830c2a8208380e438441b72 /spec/frontend/helpers
parent235dc61f473cb7f02a9453a59fb26d293e05b092 (diff)
downloadgitlab-ce-e1f8f12bbed19bea753d81d7586b30ea403733d5.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/helpers')
-rw-r--r--spec/frontend/helpers/wait_using_real_timer.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/frontend/helpers/wait_using_real_timer.js b/spec/frontend/helpers/wait_using_real_timer.js
new file mode 100644
index 00000000000..ddf23cd97b4
--- /dev/null
+++ b/spec/frontend/helpers/wait_using_real_timer.js
@@ -0,0 +1,7 @@
+/* useful for timing promises when jest fakeTimers are not reliable enough */
+export default timeout =>
+ new Promise(resolve => {
+ jest.useRealTimers();
+ setTimeout(resolve, timeout);
+ jest.useFakeTimers();
+ });