From d1251b42a09e0aaea6300f9dfc92377d24ea762e Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 21 Mar 2019 18:05:21 +0100 Subject: Wait for pending timers in Jest --- spec/frontend/test_setup.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec') diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js index 8c36d8ff49f..006fc60ef57 100644 --- a/spec/frontend/test_setup.js +++ b/spec/frontend/test_setup.js @@ -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 -- cgit v1.2.1