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

Mock and wait for timers in Jest

Closes #56056

See merge request gitlab-org/gitlab-ce!26433
This commit is contained in:
Kushal Pandya 2019-03-22 07:24:40 +00:00
commit 5765c5989a
2 changed files with 6 additions and 0 deletions

View file

@ -36,4 +36,5 @@ module.exports = {
'^.+\\.vue$': 'vue-jest',
},
transformIgnorePatterns: ['node_modules/(?!(@gitlab/ui)/)'],
timers: 'fake',
};

View file

@ -3,6 +3,11 @@ import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
// wait for pending setTimeout()s
afterEach(() => {
jest.runAllTimers();
});
initializeTestTimeout(300);
// fail tests for unmocked requests