Skip to content

docs(en): merge docs-cn/sync-docs into docs-cn/dev @ f9275a57 #650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6f3d705
fix(deps): update all non-major dependencies (#7867)
renovate[bot] Apr 24, 2025
2905288
docs: fix typo (#7886)
Elijer Apr 24, 2025
43966ff
docs: deprecate old context augmentation and recommend test.extend (#…
sheremet-va May 2, 2025
aecfe2c
fix(browser): resolve FS commands relative to the project root (#7896)
sheremet-va May 5, 2025
4f3f3a1
feat: provide `ctx.signal` (#7878)
sheremet-va May 5, 2025
2fd4f42
feat(coverage): v8 experimental AST-aware remapping (#7736)
AriPerkkio May 5, 2025
9a5874b
feat: support custom colors for `test.name` (#7809)
AriPerkkio May 5, 2025
8706c77
feat: add `vi.mockObject` to automock any object (#7761)
hi-ogawa May 5, 2025
0b7a91c
feat(browser): implement `connect` option for `playwright` browser pr…
egfx-notifications May 5, 2025
5c80186
feat: introduce `watchTriggerPatterns` option (#7778)
sheremet-va May 5, 2025
dd5596a
docs: fix example
sheremet-va May 5, 2025
a40aa27
docs: use `extends` instead of `configFile` in `injectTestProjects` (…
romhml May 5, 2025
e906203
feat: deprecate `workspace` in favor of `projects` (#7923)
sheremet-va May 5, 2025
69ccc6e
chore(snapshots): rename `message` to `hint` in method signatures (#7…
k-yle May 6, 2025
8f0fb8c
docs: fix toEqualTypeOf in testing-types.md (#7938)
tkrotoff May 6, 2025
823cf17
docs: minor prose improvements to it.for documentation (#7956)
berzi May 11, 2025
7eae51c
fix: try to catch unhandled error outside of a test (#7968)
sheremet-va May 13, 2025
1381b9a
docs: typos in `docs/guide/browser/index.md` (#7983)
flx-sta May 15, 2025
614835c
fix(typecheck): avoid creating a temporary tsconfig file when typeche…
sheremet-va May 16, 2025
fba0fad
docs: word about typeRoots for typescript configuration (#7977)
anaelChardan May 17, 2025
8da2f8a
docs: add "Parallelism" guide (#7975)
sheremet-va May 17, 2025
6eea07a
fix(cli): add built-in reporters list to --help output (#7955)
pengooseDev May 17, 2025
60e13c7
docs: fix config filename for Production build section (#7926)
gwennlbh May 17, 2025
3fbd5a6
feat: Explicit Resource Management support in mocked functions (#7927)
EskiMojo14 May 17, 2025
e6b8863
feat(browser): add `screenshot.save` option (#7777)
sheremet-va May 17, 2025
da91a4b
docs: update version
sheremet-va May 17, 2025
6ee6272
docs: update version
sheremet-va May 17, 2025
f6ba233
feat: add `sequence.groupOrder` option (#7852)
sheremet-va May 17, 2025
f9275a5
feat(browser): custom locators API (#7993)
sheremet-va May 17, 2025
9ca3e0d
docs(en): merging all conflicts
docschina-bot May 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: provide ctx.signal (#7878)
  • Loading branch information
sheremet-va authored May 5, 2025
commit 4f3f3a16c5430f7eac462009a2b7da4bb83b7481
15 changes: 15 additions & 0 deletions guide/test-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ it('math is hard', ({ skip, mind }) => {
})
```

#### `context.signal` <Version>3.2.0</Version> {#context-signal}

An [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can be aborted by Vitest. The signal is aborted in these situations:

- Test times out
- User manually cancelled the test run with Ctrl+C
- [`vitest.cancelCurrentRun`](/advanced/api/vitest#cancelcurrentrun) was called programmatically
- Another test failed in parallel and the [`bail`](/config/#bail) flag is set

```ts
it('stop request when test times out', async ({ signal }) => {
await fetch('/resource', { signal })
}, 2000)
```

#### `onTestFailed`

The [`onTestFailed`](/api/#ontestfailed) hook bound to the current test. This API is useful if you are running tests concurrently and need to have a special handling only for this specific test.
Expand Down