From 80ebd1c5be3d54820bb10f6314a443952e4b4ad8 Mon Sep 17 00:00:00 2001 From: Aileen Nowak Date: Wed, 22 Feb 2023 19:54:49 +0200 Subject: [PATCH] Fixed random timeouts in milestone service e2e test no issue - Passed specific config to `useFakeTimers` so the test only fakes the `setTimeout` call --- ghost/core/test/e2e-server/services/milestones.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ghost/core/test/e2e-server/services/milestones.test.js b/ghost/core/test/e2e-server/services/milestones.test.js index 6eeb0a7212..5bc552fd18 100644 --- a/ghost/core/test/e2e-server/services/milestones.test.js +++ b/ghost/core/test/e2e-server/services/milestones.test.js @@ -158,7 +158,10 @@ describe('Milestones Service', function () { loggingStub = sinon.stub(logging, 'info'); const threeMonthsAgo = new Date(); threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3); - clock = sinon.useFakeTimers(threeMonthsAgo.getTime()); + clock = sinon.useFakeTimers({ + now: threeMonthsAgo.getTime(), + toFake: ['setTimeout'] + }); sinon.createSandbox(); configUtils.set('milestones', milestonesConfig); mockManager.mockLabsEnabled('milestoneEmails');