Commit 5765c598 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'winh-jest-time' into 'master'

Mock and wait for timers in Jest

Closes #56056

See merge request gitlab-org/gitlab-ce!26433
parents f6772ffb fcf64da0
...@@ -36,4 +36,5 @@ module.exports = { ...@@ -36,4 +36,5 @@ module.exports = {
'^.+\\.vue$': 'vue-jest', '^.+\\.vue$': 'vue-jest',
}, },
transformIgnorePatterns: ['node_modules/(?!(@gitlab/ui)/)'], transformIgnorePatterns: ['node_modules/(?!(@gitlab/ui)/)'],
timers: 'fake',
}; };
...@@ -3,6 +3,11 @@ import Translate from '~/vue_shared/translate'; ...@@ -3,6 +3,11 @@ import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout'; import { initializeTestTimeout } from './helpers/timeout';
// wait for pending setTimeout()s
afterEach(() => {
jest.runAllTimers();
});
initializeTestTimeout(300); initializeTestTimeout(300);
// fail tests for unmocked requests // fail tests for unmocked requests
......
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