[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

docs: fixed setupfiles link (#9390)

authored by

rxliuli and committed by
GitHub
(Jan 8, 2026, 10:35 AM +0100) d9729e90 41d82762

+9 -9
+2 -2
docs/api/expect.md
··· 1758 1758 1759 1759 This method adds custom serializers that are called when creating a snapshot. This is an advanced feature - if you want to know more, please read a [guide on custom serializers](/guide/snapshot#custom-serializer). 1760 1760 1761 - If you are adding custom serializers, you should call this method inside [`setupFiles`](/config/#setupfiles). This will affect every snapshot. 1761 + If you are adding custom serializers, you should call this method inside [`setupFiles`](/config/setupfiles). This will affect every snapshot. 1762 1762 1763 1763 :::tip 1764 1764 If you previously used Vue CLI with Jest, you might want to install [jest-serializer-vue](https://www.npmjs.com/package/jest-serializer-vue). Otherwise, your snapshots will be wrapped in a string, which cases `"` to be escaped. ··· 1793 1793 ``` 1794 1794 1795 1795 ::: tip 1796 - If you want your matchers to appear in every test, you should call this method inside [`setupFiles`](/config/#setupfiles). 1796 + If you want your matchers to appear in every test, you should call this method inside [`setupFiles`](/config/setupfiles). 1797 1797 ::: 1798 1798 1799 1799 This function is compatible with Jest's `expect.extend`, so any library that uses it to create custom matchers will work with Vitest.
+2 -2
docs/api/vi.md
··· 42 42 43 43 In order to hoist `vi.mock`, Vitest statically analyzes your files. It indicates that `vi` that was not directly imported from the `vitest` package (for example, from some utility file) cannot be used. Use `vi.mock` with `vi` imported from `vitest`, or enable [`globals`](/config/#globals) config option. 44 44 45 - Vitest will not mock modules that were imported inside a [setup file](/config/#setupfiles) because they are cached by the time a test file is running. You can call [`vi.resetModules()`](#vi-resetmodules) inside [`vi.hoisted`](#vi-hoisted) to clear all module caches before running a test file. 45 + Vitest will not mock modules that were imported inside a [setup file](/config/setupfiles) because they are cached by the time a test file is running. You can call [`vi.resetModules()`](#vi-resetmodules) inside [`vi.hoisted`](#vi-hoisted) to clear all module caches before running a test file. 46 46 ::: 47 47 48 48 If the `factory` function is defined, all imports will return its result. Vitest calls factory only once and caches results for all subsequent imports until [`vi.unmock`](#vi-unmock) or [`vi.doUnmock`](#vi-dounmock) is called. ··· 168 168 ``` 169 169 170 170 ::: warning 171 - Beware that if you don't call `vi.mock`, modules **are not** mocked automatically. To replicate Jest's automocking behaviour, you can call `vi.mock` for each required module inside [`setupFiles`](/config/#setupfiles). 171 + Beware that if you don't call `vi.mock`, modules **are not** mocked automatically. To replicate Jest's automocking behaviour, you can call `vi.mock` for each required module inside [`setupFiles`](/config/setupfiles). 172 172 ::: 173 173 174 174 If there is no `__mocks__` folder or a factory provided, Vitest will import the original module and auto-mock all its exports. For the rules applied, see [algorithm](/guide/mocking/modules#automocking-algorithm).
+2 -2
docs/guide/migration.md
··· 319 319 320 320 - `maxThreads` and `maxForks` are now `maxWorkers`. 321 321 - Environment variables `VITEST_MAX_THREADS` and `VITEST_MAX_FORKS` are now `VITEST_MAX_WORKERS`. 322 - - `singleThread` and `singleFork` are now `maxWorkers: 1, isolate: false`. If your tests were relying on module reset between tests, you'll need to add [setupFile](/config/#setupfiles) that calls [`vi.resetModules()`](/api/vi.html#vi-resetmodules) in [`beforeAll` test hook](/api/#beforeall). 322 + - `singleThread` and `singleFork` are now `maxWorkers: 1, isolate: false`. If your tests were relying on module reset between tests, you'll need to add [setupFile](/config/setupfiles) that calls [`vi.resetModules()`](/api/vi.html#vi-resetmodules) in [`beforeAll` test hook](/api/#beforeall). 323 323 - `poolOptions` is removed. All previous `poolOptions` are now top-level options. The `memoryLimit` of VM pools is renamed to `vmMemoryLimit`. 324 324 - `threads.useAtomics` is removed. If you have a use case for this, feel free to open a new feature request. 325 325 - Custom pool interface has been rewritten, see [Custom Pool](/guide/advanced/pool#custom-pool) ··· 539 539 540 540 ### Auto-Mocking Behaviour 541 541 542 - Unlike Jest, mocked modules in `<root>/__mocks__` are not loaded unless `vi.mock()` is called. If you need them to be mocked in every test, like in Jest, you can mock them inside [`setupFiles`](/config/#setupfiles). 542 + Unlike Jest, mocked modules in `<root>/__mocks__` are not loaded unless `vi.mock()` is called. If you need them to be mocked in every test, like in Jest, you can mock them inside [`setupFiles`](/config/setupfiles). 543 543 544 544 ### Importing the Original of a Mocked Package 545 545
+1 -1
docs/guide/profiling-test-performance.md
··· 16 16 > ``` 17 17 18 18 - Transform: How much time was spent transforming the files. See [File Transform](#file-transform). 19 - - Setup: Time spent for running the [`setupFiles`](/config/#setupfiles) files. 19 + - Setup: Time spent for running the [`setupFiles`](/config/setupfiles) files. 20 20 - Import: Time it took to import your test files and their dependencies. This also includes the time spent collecting all tests. Note that this doesn't include dynamic imports inside of tests. 21 21 - Tests: Time spent for actually running the test cases. 22 22 - Environment: Time spent for setting up the test [`environment`](/config/#environment), for example JSDOM.
+1 -1
docs/guide/mocking/modules.md
··· 56 56 ``` 57 57 58 58 ::: tip 59 - Remember that you can call `vi.mock` in a [setup file](/config/#setupfiles) to apply the module mock in every test file automatically. 59 + Remember that you can call `vi.mock` in a [setup file](/config/setupfiles) to apply the module mock in every test file automatically. 60 60 ::: 61 61 62 62 ::: tip
+1 -1
docs/guide/mocking/requests.md
··· 6 6 7 7 ## Configuration 8 8 9 - You can use it like below in your [setup file](/config/#setupfiles) 9 + You can use it like below in your [setup file](/config/setupfiles) 10 10 11 11 ::: code-group 12 12