Skip to content

Commit d9729e9

Browse files
authored
docs: fixed setupfiles link (#9390)
1 parent 41d8276 commit d9729e9

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

docs/api/expect.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ You can use `expect.not` with this matcher to negate the expected value.
17581758

17591759
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).
17601760

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.
17621762

17631763
:::tip
17641764
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,7 +1793,7 @@ test('custom matchers', () => {
17931793
```
17941794

17951795
::: 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).
17971797
:::
17981798

17991799
This function is compatible with Jest's `expect.extend`, so any library that uses it to create custom matchers will work with Vitest.

docs/api/vi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Substitutes all imported modules from provided `path` with another module. You c
4242

4343
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.
4444

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.
4646
:::
4747

4848
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,7 +168,7 @@ axios.get(`/apples/${increment(1)}`)
168168
```
169169

170170
::: 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).
172172
:::
173173

174174
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).

docs/guide/migration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ New pool architecture allows Vitest to simplify many previously complex configur
319319

320320
- `maxThreads` and `maxForks` are now `maxWorkers`.
321321
- 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).
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)
@@ -539,7 +539,7 @@ For more details please refer to the [`vi.mock` api section](/api/vi#vi-mock).
539539

540540
### Auto-Mocking Behaviour
541541

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).
543543

544544
### Importing the Original of a Mocked Package
545545

docs/guide/mocking/modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ vi.mock(import('./example.js'), () => {
5656
```
5757

5858
::: 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.
6060
:::
6161

6262
::: tip

docs/guide/mocking/requests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Mock Service Worker (MSW) works by intercepting the requests your tests make, al
66

77
## Configuration
88

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)
1010

1111
::: code-group
1212

docs/guide/profiling-test-performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ When you run Vitest it reports multiple time metrics of your tests:
1616
> ```
1717
1818
- 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.
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.

0 commit comments

Comments
 (0)