diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-09-06 19:36:04 +0200 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2018-12-11 13:06:19 +0100 |
commit | fac4d54f3d4a7ce2e992c490c9a1164ae4ff17ac (patch) | |
tree | 3c1b3d7d4541af2cdd28f0564827fa72e833af12 /spec/frontend | |
parent | ca3603de56445862b47cbc9b8eec50cbf82d71c3 (diff) | |
download | gitlab-ce-fac4d54f3d4a7ce2e992c490c9a1164ae4ff17ac.tar.gz |
Fail long running tests
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/test_setup.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js new file mode 100644 index 00000000000..742ea60ecbd --- /dev/null +++ b/spec/frontend/test_setup.js @@ -0,0 +1,16 @@ +const testTimeoutInMs = 0; +jest.setTimeout(testTimeoutInMs); + +let testStartTime; + +// https://github.com/facebook/jest/issues/6947 +beforeEach(() => { + testStartTime = Date.now(); +}); + +afterEach(() => { + const elapsedTimeInMs = Date.now() - testStartTime; + if (elapsedTimeInMs > testTimeoutInMs) { + throw new Error(`Test took too long (${elapsedTimeInMs}ms > ${testTimeoutInMs}ms)!`); + } +}); |