Skip to content

Commit

Permalink
fix(happy-dom): don't crash when calling useFakeTimers with empty con…
Browse files Browse the repository at this point in the history
…fig (#4214)
  • Loading branch information
sheremet-va committed Oct 2, 2023
1 parent b7ebfef commit 2e1a1bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vitest/src/integrations/vi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function createVitest(): VitestUtils {
}

if (config)
_timers.configure(config)
_timers.configure({ ...workerState.config.fakeTimers, ...config })
else
_timers.configure(workerState.config.fakeTimers)

Expand Down
11 changes: 11 additions & 0 deletions test/core/test/environments/happy-dom.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @vitest-environment happy-dom

import { afterEach, test, vi } from 'vitest'

afterEach(() => {
vi.useRealTimers()
})

test('fake timers don\'t fail when using empty config', () => {
vi.useFakeTimers({})
})

0 comments on commit 2e1a1bd

Please sign in to comment.