Skip to content

Commit 4ec6ed9

Browse files
committed
docs: add "stop" button explanation
1 parent 65c2444 commit 4ec6ed9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@ You can change the behaviour of testing view by modifying `testing.automatically
132132

133133
This is a vscode's built-in option and will control every plugin.
134134

135+
### The "Stop" button doesn't stop the test fast enough
136+
137+
The stop button stops the test gracefuly in case your test needs to release resources, so Vitest always awaits until the current test is finished. Since Vitest 3.2, you can use a `signal` to stop any pending promises (like a `fetch` or `db` connection) when the test is interrupted:
138+
139+
```ts
140+
test('fetch test', async ({ signal }) => {
141+
// passing down a signal to fetch will make it so the fetch
142+
// is rejected when the signal is aborted
143+
await fetch('some-log-or-stuck-call', { signal })
144+
})
145+
```
146+
135147
### I am using `vitest.shellType: terminal`, but I don't see the terminal
136148

137149
The extension uses a modified Vitest script that removes the reporter output. For this reason, the terminal is hidden by default. However, it might be useful to debug issues with the extension or Vitest itself - to open the terminal in the "Terminals" view you can use the "Vitest: Show Shell Terminal" command.

0 commit comments

Comments
 (0)