Skip to content

Commit 2e1a1bd

Browse files
authored
fix(happy-dom): don't crash when calling useFakeTimers with empty config (#4214)
1 parent b7ebfef commit 2e1a1bd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/vitest/src/integrations/vi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function createVitest(): VitestUtils {
217217
}
218218

219219
if (config)
220-
_timers.configure(config)
220+
_timers.configure({ ...workerState.config.fakeTimers, ...config })
221221
else
222222
_timers.configure(workerState.config.fakeTimers)
223223

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @vitest-environment happy-dom
2+
3+
import { afterEach, test, vi } from 'vitest'
4+
5+
afterEach(() => {
6+
vi.useRealTimers()
7+
})
8+
9+
test('fake timers don\'t fail when using empty config', () => {
10+
vi.useFakeTimers({})
11+
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy