You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bbf2f0d
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(deps): update fake-timers to 15.3.2. support toNotFake (#10043)
Copy file name to clipboardExpand all lines: docs/config/faketimers.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ outline: deep
5
5
6
6
# fakeTimers
7
7
8
-
-**Type:**`FakeTimerInstallOpts`
8
+
-**Type:**`FakeTimerConfig`
9
9
10
10
Options that Vitest will pass down to [`@sinon/fake-timers`](https://npmx.dev/package/@sinonjs/fake-timers) when using [`vi.useFakeTimers()`](/api/vi#vi-usefaketimers).
11
11
@@ -21,12 +21,23 @@ Installs fake timers with the specified Unix epoch.
-**Default:** everything available globally except `nextTick` and `queueMicrotask`
23
23
24
-
An array with names of global methods and APIs to fake.
25
-
26
-
To only mock `setTimeout()` and `nextTick()`, specify this property as `['setTimeout', 'nextTick']`.
24
+
An array with names of global methods and APIs to fake. For example, to only mock `setTimeout()` and `nextTick()`, specify this property as `['setTimeout', 'nextTick']`.
27
25
28
26
Mocking `nextTick` is not supported when running Vitest inside `node:child_process` by using `--pool=forks`. NodeJS uses `process.nextTick` internally in `node:child_process` and hangs when it is mocked. Mocking `nextTick` is supported when running Vitest with `--pool=threads`.
An array with names of global methods and APIs to keep native. All other available timers will be mocked. For example, to keep `setInterval()` native and mock all other timers, specify this property as `['setInterval']`.
34
+
35
+
Mocking `nextTick` is not supported when running Vitest inside `node:child_process` by using `--pool=forks`. When running with `--pool=forks`, Vitest automatically adds `nextTick` to the `toNotFake` array.
36
+
37
+
::: warning
38
+
Using both `toFake` and `toNotFake` together is not supported.
0 commit comments