Skip to content

Commit e3144fd

Browse files
authoredDec 5, 2024··
fix(vitest)!: don't expose default toFake config (#6288)
1 parent e8ce94c commit e3144fd

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed
 

Diff for: ‎docs/config/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2527,7 +2527,7 @@ Installs fake timers with the specified Unix epoch.
25272527
#### fakeTimers.toFake
25282528

25292529
- **Type:** `('setTimeout' | 'clearTimeout' | 'setImmediate' | 'clearImmediate' | 'setInterval' | 'clearInterval' | 'Date' | 'nextTick' | 'hrtime' | 'requestAnimationFrame' | 'cancelAnimationFrame' | 'requestIdleCallback' | 'cancelIdleCallback' | 'performance' | 'queueMicrotask')[]`
2530-
- **Default:** `['setTimeout', 'clearTimeout', 'setImmediate', 'clearImmediate', 'setInterval', 'clearInterval', 'Date']`
2530+
- **Default:** everything available globally except `nextTick`
25312531

25322532
An array with names of global methods and APIs to fake.
25332533

Diff for: ‎packages/vitest/src/defaults.ts

-9
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,6 @@ export const coverageConfigDefaults: ResolvedCoverageOptions = {
8888
export const fakeTimersDefaults = {
8989
loopLimit: 10_000,
9090
shouldClearNativeTimers: true,
91-
toFake: [
92-
'setTimeout',
93-
'clearTimeout',
94-
'setInterval',
95-
'clearInterval',
96-
'setImmediate',
97-
'clearImmediate',
98-
'Date',
99-
],
10091
} satisfies NonNullable<UserConfig['fakeTimers']>
10192

10293
const config = {

Diff for: ‎patches/@types__sinonjs__fake-timers@8.1.5.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ index 5aa018cde4336aca4dadefb8338549c378792e14..2e0c38efc15e793dc37e401e25130162
1010
- * For instance, `FakeTimers.install({ toFake: ['setTimeout', 'nextTick'] })` will fake only `setTimeout()` and `nextTick()`
1111
+ * An array with names of global methods and APIs to fake.
1212
+ * For instance, `vi.useFakeTimer({ toFake: ['setTimeout', 'performance'] })` will fake only `setTimeout()` and `performance.now()`
13-
+ * @default ['setTimeout', 'clearTimeout', 'setImmediate', 'clearImmediate', 'setInterval', 'clearInterval', 'Date']
13+
+ * @default everything available globally except `nextTick`
1414
*/
1515
toFake?: FakeMethod[] | undefined;
1616

Diff for: ‎pnpm-lock.yaml

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.