Skip to content

Commit 0149d73

Browse files
test(core): fix fake-timer teardown order in retryPolicy tests
jest.useRealTimers() ran before jest.restoreAllMocks(), so the setTimeout spy was restored onto globalThis after real timers had already been reinstated. Harmless within this file since each beforeEach re-fakes timers, but the order was backwards. Per review on #3420. Co-authored-by: Cursor <[email protected]>
1 parent 3a453b2 commit 0149d73

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎packages/core/test/sdk/graphql/retryPolicy.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ describe('useQuery retry policy', () => {
4343
})
4444

4545
afterEach(() => {
46-
jest.useRealTimers()
46+
// Restore mocks before reinstating real timers, so the `setTimeout` spy
47+
// is not put back onto `globalThis` while timers are still faked.
4748
jest.restoreAllMocks()
49+
jest.useRealTimers()
4850
})
4951

5052
it('never retries an upstream rate limit (429)', () => {

0 commit comments

Comments
 (0)