diff options
author | Fatih Acet <acetfatih@gmail.com> | 2019-04-01 20:55:17 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-04-01 20:55:17 +0000 |
commit | 9269ac1b6951aa5d239c77bab36bd736b8e71b12 (patch) | |
tree | 8fba6162e26cadd08e1ca3b686d00f43e7337a41 /spec/frontend/test_setup.js | |
parent | 2f4a623817618d89866915e585396debb220a7a0 (diff) | |
parent | 0e9c092d003fb9febcbaf9fd33ddbbb40ed3191d (diff) | |
download | gitlab-ce-9269ac1b6951aa5d239c77bab36bd736b8e71b12.tar.gz |
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.js | 13 |
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); |