Skip to content

Commit 3c18ecf

Browse files
authored
docs: replace Vitest 2.2 mentions (#7025)
1 parent be8d479 commit 3c18ecf

File tree

11 files changed

+31
-31
lines changed

11 files changed

+31
-31
lines changed

docs/advanced/api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ export default function setup({ provide }) {
140140
```
141141
:::
142142
143-
## TestProject <Version>2.2.0</Version> {#testproject}
143+
## TestProject <Version>3.0.0</Version> {#testproject}
144144
145-
- **Alias**: `WorkspaceProject` before 2.2.0
145+
- **Alias**: `WorkspaceProject` before 3.0.0
146146
147147
### name
148148

docs/advanced/pool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default defineConfig({
4949
```
5050

5151
::: info
52-
The `workspace` field was introduced in Vitest 2.2. To define a workspace in Vitest <2.2, create a separate `vitest.workspace.ts` file.
52+
The `workspace` field was introduced in Vitest 3. To define a workspace in [Vitest <3](https://v2.vitest.dev/), create a separate `vitest.workspace.ts` file.
5353
:::
5454

5555
## API

docs/api/expect.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ test('element exists', async () => {
8282
```
8383

8484
::: warning
85-
`expect.poll` makes every assertion asynchronous, so you need to await it. Since Vitest 2.2, if you forget to await it, the test will fail with a warning to do so.
85+
`expect.poll` makes every assertion asynchronous, so you need to await it. Since Vitest 3, if you forget to await it, the test will fail with a warning to do so.
8686

8787
`expect.poll` doesn't work with several matchers:
8888

@@ -465,7 +465,7 @@ test('structurally the same, but semantically different', () => {
465465

466466
- **Type:** `(received: string) => Awaitable<void>`
467467

468-
`toContain` asserts if the actual value is in an array. `toContain` can also check whether a string is a substring of another string. Since Vitest 1.0, if you are running tests in a browser-like environment, this assertion can also check if class is contained in a `classList`, or an element is inside another one.
468+
`toContain` asserts if the actual value is in an array. `toContain` can also check whether a string is a substring of another string. If you are running tests in a browser-like environment, this assertion can also check if class is contained in a `classList`, or an element is inside another one.
469469

470470
```ts
471471
import { expect, test } from 'vitest'
@@ -876,7 +876,7 @@ test('spy function', () => {
876876
})
877877
```
878878

879-
## toHaveBeenCalledBefore <Version>2.2.0</Version> {#tohavebeencalledbefore}
879+
## toHaveBeenCalledBefore <Version>3.0.0</Version> {#tohavebeencalledbefore}
880880

881881
- **Type**: `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable<void>`
882882

@@ -895,7 +895,7 @@ test('calls mock1 before mock2', () => {
895895
})
896896
```
897897

898-
## toHaveBeenCalledAfter <Version>2.2.0</Version> {#tohavebeencalledafter}
898+
## toHaveBeenCalledAfter <Version>3.0.0</Version> {#tohavebeencalledafter}
899899

900900
- **Type**: `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable<void>`
901901

@@ -914,7 +914,7 @@ test('calls mock1 after mock2', () => {
914914
})
915915
```
916916

917-
## toHaveBeenCalledExactlyOnceWith <Version>2.2.0</Version> {#tohavebeencalledexactlyoncewith}
917+
## toHaveBeenCalledExactlyOnceWith <Version>3.0.0</Version> {#tohavebeencalledexactlyoncewith}
918918

919919
- **Type**: `(...args: any[]) => Awaitable<void>`
920920

@@ -1248,7 +1248,7 @@ test('buyApples returns new stock id', async () => {
12481248
:::warning
12491249
If the assertion is not awaited, then you will have a false-positive test that will pass every time. To make sure that assertions are actually called, you may use [`expect.assertions(number)`](#expect-assertions).
12501250

1251-
Since Vitest 2.2, if a method is not awaited, Vitest will show a warning at the end of the test. In Vitest 3, the test will be marked as "failed" if the assertion is not awaited.
1251+
Since Vitest 3, if a method is not awaited, Vitest will show a warning at the end of the test. In Vitest 4, the test will be marked as "failed" if the assertion is not awaited.
12521252
:::
12531253

12541254
## rejects
@@ -1279,7 +1279,7 @@ test('buyApples throws an error when no id provided', async () => {
12791279
:::warning
12801280
If the assertion is not awaited, then you will have a false-positive test that will pass every time. To make sure that assertions were actually called, you can use [`expect.assertions(number)`](#expect-assertions).
12811281

1282-
Since Vitest 2.2, if a method is not awaited, Vitest will show a warning at the end of the test. In Vitest 3, the test will be marked as "failed" if the assertion is not awaited.
1282+
Since Vitest 3, if a method is not awaited, Vitest will show a warning at the end of the test. In Vitest 4, the test will be marked as "failed" if the assertion is not awaited.
12831283
:::
12841284

12851285
## expect.assertions

docs/api/vi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If the `factory` function is defined, all imports will return its result. Vitest
3333

3434
Unlike in `jest`, the factory can be asynchronous. You can use [`vi.importActual`](#vi-importactual) or a helper with the factory passed in as the first argument, and get the original module inside.
3535

36-
Since Vitest 2.1, you can also provide an object with a `spy` property instead of a factory function. If `spy` is `true`, then Vitest will automock the module as usual, but it won't override the implementation of exports. This is useful if you just want to assert that the exported method was called correctly by another method.
36+
You can also provide an object with a `spy` property instead of a factory function. If `spy` is `true`, then Vitest will automock the module as usual, but it won't override the implementation of exports. This is useful if you just want to assert that the exported method was called correctly by another method.
3737

3838
```ts
3939
import { calculator } from './src/calculator.ts'

docs/config/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default defineConfig({
2626
})
2727
```
2828

29-
The `<reference types="vitest" />` will stop working in Vitest 3, but you can start migrating to `vitest/config` in Vitest 2.1:
29+
The `<reference types="vitest" />` will stop working in Vitest 4, but you can already start migrating to `vitest/config`:
3030

3131
```ts [vite.config.js]
3232
/// <reference types="vitest/config" />
@@ -579,8 +579,8 @@ These options are passed down to `setup` method of current [`environment`](#envi
579579
- **Type:** `[string, EnvironmentName][]`
580580
- **Default:** `[]`
581581

582-
::: warning
583-
This API was deprecated in Vitest 2.2. Use [workspace](/guide/workspace) to define different configurations instead.
582+
::: danger DEPRECATED
583+
This API was deprecated in Vitest 3. Use [workspace](/guide/workspace) to define different configurations instead.
584584

585585
```ts
586586
export default defineConfig({
@@ -626,8 +626,8 @@ export default defineConfig({
626626
- **Type:** `[string, 'threads' | 'forks' | 'vmThreads' | 'vmForks' | 'typescript'][]`
627627
- **Default:** `[]`
628628

629-
::: warning
630-
This API was deprecated in Vitest 2.2. Use [workspace](/guide/workspace) to define different configurations instead:
629+
::: danger DEPRECATED
630+
This API was deprecated in Vitest 3. Use [workspace](/guide/workspace) to define different configurations instead:
631631

632632
```ts
633633
export default defineConfig({
@@ -1193,7 +1193,7 @@ import { inject } from 'vitest'
11931193

11941194
inject('wsPort') === 3000
11951195
```
1196-
```ts [globalSetup.ts <Version>2.2.0</Version>]
1196+
```ts [globalSetup.ts <Version>3.0.0</Version>]
11971197
import type { TestProject } from 'vitest/node'
11981198

11991199
export default function setup(project: TestProject) {
@@ -1221,7 +1221,7 @@ declare module 'vitest' {
12211221
```
12221222
:::
12231223

1224-
Since Vitest 2.2.0, you can define a custom callback function to be called when Vitest reruns tests. If the function is asynchronous, the runner will wait for it to complete before executing tests. Note that you cannot destruct the `project` like `{ onTestsRerun }` because it relies on the context.
1224+
Since Vitest 3, you can define a custom callback function to be called when Vitest reruns tests. If the function is asynchronous, the runner will wait for it to complete before executing tests. Note that you cannot destruct the `project` like `{ onTestsRerun }` because it relies on the context.
12251225

12261226
```ts [globalSetup.ts]
12271227
import type { TestProject } from 'vitest/node'
@@ -2571,7 +2571,7 @@ Tells fake timers to clear "native" (i.e. not fake) timers by delegating to thei
25712571

25722572
Path to a [workspace](/guide/workspace) config file relative to [root](#root).
25732573

2574-
Since Vitest 2.2, you can also define the workspace array in the root config. If the `workspace` is defined in the config manually, Vitest will ignore the `vitest.workspace` file in the root.
2574+
Since Vitest 3, you can also define the workspace array in the root config. If the `workspace` is defined in the config manually, Vitest will ignore the `vitest.workspace` file in the root.
25752575

25762576
### isolate
25772577

docs/guide/browser/locators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ It is recommended to use this only after the other locators don't work for your
389389

390390
## Methods
391391

392-
All methods are asynchronous and must be awaited. Since Vitest 2.2, tests will fail if a method is not awaited.
392+
All methods are asynchronous and must be awaited. Since Vitest 3, tests will fail if a method is not awaited.
393393

394394
### click
395395

docs/guide/environment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ By default, you can use these environments:
1616
::: info
1717
When using `jsdom` or `happy-dom` environments, Vitest follows the same rules that Vite does when importing [CSS](https://vitejs.dev/guide/features.html#css) and [assets](https://vitejs.dev/guide/features.html#static-assets). If importing external dependency fails with `unknown extension .css` error, you need to inline the whole import chain manually by adding all packages to [`server.deps.external`](/config/#server-deps-external). For example, if the error happens in `package-3` in this import chain: `source code -> package-1 -> package-2 -> package-3`, you need to add all three packages to `server.deps.external`.
1818

19-
Since Vitest 2.0.4 the `require` of CSS and assets inside the external dependencies are resolved automatically.
19+
The `require` of CSS and assets inside the external dependencies are resolved automatically.
2020
:::
2121

2222
::: warning

docs/guide/filtering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ basic/foo.test.ts
2424

2525
You can also use the `-t, --testNamePattern <pattern>` option to filter tests by full name. This can be helpful when you want to filter by the name defined within a file rather than the filename itself.
2626

27-
Since Vitest 2.2, you can also specify the test by filename and line number:
27+
Since Vitest 3, you can also specify the test by filename and line number:
2828

2929
```bash
3030
$ vitest basic/foo.test.ts:10

docs/guide/reporters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ Example of a JSON report:
373373
```
374374

375375
::: info
376-
Since Vitest 2.2, the JSON reporter includes coverage information in `coverageMap` if coverage is enabled.
376+
Since Vitest 3, the JSON reporter includes coverage information in `coverageMap` if coverage is enabled.
377377
:::
378378

379379
### HTML Reporter

docs/guide/test-context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ test('works correctly')
180180

181181
#### Default fixture
182182

183-
Since Vitest 2.2, you can provide different values in different [projects](/guide/workspace). To enable this feature, pass down `{ injected: true }` to the options. If the key is not specified in the [project configuration](/config/#provide), then the default value will be used.
183+
Since Vitest 3, you can provide different values in different [projects](/guide/workspace). To enable this feature, pass down `{ injected: true }` to the options. If the key is not specified in the [project configuration](/config/#provide), then the default value will be used.
184184

185185
:::code-group
186186
```ts [fixtures.test.ts]

0 commit comments

Comments
 (0)