Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2019-04-01 23:55:17 +0300
committerFatih Acet <acetfatih@gmail.com>2019-04-01 23:55:17 +0300
commit9269ac1b6951aa5d239c77bab36bd736b8e71b12 (patch)
tree8fba6162e26cadd08e1ca3b686d00f43e7337a41 /spec/frontend/test_setup.js
parent2f4a623817618d89866915e585396debb220a7a0 (diff)
parent0e9c092d003fb9febcbaf9fd33ddbbb40ed3191d (diff)
Merge branch 'winh-rejected-jest-promises' into 'master'
Fail Jest tests for unhandled Promise rejections Closes #56053 See merge request gitlab-org/gitlab-ce!26424
Diffstat (limited to 'spec/frontend/test_setup.js')
-rw-r--r--spec/frontend/test_setup.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js
index f09bcb5407e..c57e0e7cfc6 100644
--- a/spec/frontend/test_setup.js
+++ b/spec/frontend/test_setup.js
@@ -5,10 +5,15 @@ import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
import { getJSONFixture, loadHTMLFixture, setHTMLFixture } from './helpers/fixtures';
-// wait for pending setTimeout()s
-afterEach(() => {
- jest.runAllTimers();
-});
+process.on('unhandledRejection', global.promiseRejectionHandler);
+
+afterEach(() =>
+ // give Promises a bit more time so they fail the right test
+ new Promise(setImmediate).then(() => {
+ // wait for pending setTimeout()s
+ jest.runAllTimers();
+ }),
+);
initializeTestTimeout(300);