···1758175817591759This 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).
1760176017611761-If you are adding custom serializers, you should call this method inside [`setupFiles`](/config/#setupfiles). This will affect every snapshot.
17611761+If you are adding custom serializers, you should call this method inside [`setupFiles`](/config/setupfiles). This will affect every snapshot.
1762176217631763:::tip
17641764If 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.
···17931793```
1794179417951795::: tip
17961796-If you want your matchers to appear in every test, you should call this method inside [`setupFiles`](/config/#setupfiles).
17961796+If you want your matchers to appear in every test, you should call this method inside [`setupFiles`](/config/setupfiles).
17971797:::
1798179817991799This 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
···42424343In 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.
44444545-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.
4545+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.
4646:::
47474848If 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.
···168168```
169169170170::: warning
171171-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).
171171+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).
172172:::
173173174174If 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
···319319320320- `maxThreads` and `maxForks` are now `maxWorkers`.
321321- Environment variables `VITEST_MAX_THREADS` and `VITEST_MAX_FORKS` are now `VITEST_MAX_WORKERS`.
322322-- `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).
322322+- `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).
323323- `poolOptions` is removed. All previous `poolOptions` are now top-level options. The `memoryLimit` of VM pools is renamed to `vmMemoryLimit`.
324324- `threads.useAtomics` is removed. If you have a use case for this, feel free to open a new feature request.
325325- Custom pool interface has been rewritten, see [Custom Pool](/guide/advanced/pool#custom-pool)
···539539540540### Auto-Mocking Behaviour
541541542542-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).
542542+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).
543543544544### Importing the Original of a Mocked Package
545545
+1-1
docs/guide/profiling-test-performance.md
···1616> ```
17171818- Transform: How much time was spent transforming the files. See [File Transform](#file-transform).
1919-- Setup: Time spent for running the [`setupFiles`](/config/#setupfiles) files.
1919+- Setup: Time spent for running the [`setupFiles`](/config/setupfiles) files.
2020- 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.
2121- Tests: Time spent for actually running the test cases.
2222- Environment: Time spent for setting up the test [`environment`](/config/#environment), for example JSDOM.
+1-1
docs/guide/mocking/modules.md
···5656```
57575858::: tip
5959-Remember that you can call `vi.mock` in a [setup file](/config/#setupfiles) to apply the module mock in every test file automatically.
5959+Remember that you can call `vi.mock` in a [setup file](/config/setupfiles) to apply the module mock in every test file automatically.
6060:::
61616262::: tip
+1-1
docs/guide/mocking/requests.md
···6677## Configuration
8899-You can use it like below in your [setup file](/config/#setupfiles)
99+You can use it like below in your [setup file](/config/setupfiles)
10101111::: code-group
1212