Commit 775c96b9 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'ps-fix-jest-time-reporting' into 'master'

Fix jest time reporting by resetting environment

See merge request gitlab-org/gitlab!54033
parents 3b400367 d37e8b7b
......@@ -4,7 +4,10 @@ const path = require('path');
const { ErrorWithStack } = require('jest-util');
const JSDOMEnvironment = require('jest-environment-jsdom');
const { TEST_HOST } = require('./__helpers__/test_constants');
const { setGlobalDateToFakeDate } = require('./__helpers__/fake_date/fake_date');
const {
setGlobalDateToFakeDate,
setGlobalDateToRealDate,
} = require('./__helpers__/fake_date/fake_date');
const ROOT_PATH = path.resolve(__dirname, '../..');
......@@ -74,6 +77,9 @@ class CustomEnvironment extends JSDOMEnvironment {
}
async teardown() {
// Reset `Date` so that Jest can report timing accurately *roll eyes*...
setGlobalDateToRealDate();
await new Promise(setImmediate);
if (this.rejectedPromises.length > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment