gitlab-org--gitlab-foss/spec/frontend/helpers/wait_using_real_timer.js

7 lines
223 B
JavaScript

/* useful for timing promises when jest fakeTimers are not reliable enough */
export default timeout =>
new Promise(resolve => {
jest.useRealTimers();
setTimeout(resolve, timeout);
jest.useFakeTimers();
});