Skip to content

Commit

Permalink
fix(vitest)!: don't expose default toFake config (#6288)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Dec 5, 2024
1 parent e8ce94c commit e3144fd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,7 @@ Installs fake timers with the specified Unix epoch.
#### fakeTimers.toFake

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

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

Expand Down
9 changes: 0 additions & 9 deletions packages/vitest/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ export const coverageConfigDefaults: ResolvedCoverageOptions = {
export const fakeTimersDefaults = {
loopLimit: 10_000,
shouldClearNativeTimers: true,
toFake: [
'setTimeout',
'clearTimeout',
'setInterval',
'clearInterval',
'setImmediate',
'clearImmediate',
'Date',
],
} satisfies NonNullable<UserConfig['fakeTimers']>

const config = {
Expand Down
2 changes: 1 addition & 1 deletion patches/@types__sinonjs__fake-timers@8.1.5.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ index 5aa018cde4336aca4dadefb8338549c378792e14..2e0c38efc15e793dc37e401e25130162
- * For instance, `FakeTimers.install({ toFake: ['setTimeout', 'nextTick'] })` will fake only `setTimeout()` and `nextTick()`
+ * An array with names of global methods and APIs to fake.
+ * For instance, `vi.useFakeTimer({ toFake: ['setTimeout', 'performance'] })` will fake only `setTimeout()` and `performance.now()`
+ * @default ['setTimeout', 'clearTimeout', 'setImmediate', 'clearImmediate', 'setInterval', 'clearInterval', 'Date']
+ * @default everything available globally except `nextTick`
*/
toFake?: FakeMethod[] | undefined;

Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e3144fd

Please sign in to comment.