MCPcopy
hub / github.com/vitest-dev/vitest / cancelCurrentRun

Method cancelCurrentRun

packages/vitest/src/node/core.ts:1172–1178  ·  view source on GitHub ↗

* Gracefully cancel the current test run. Vitest will wait until all running tests are finished before cancelling.

(reason: CancelReason)

Source from the content-addressed store, hash-verified

1170 * Gracefully cancel the current test run. Vitest will wait until all running tests are finished before cancelling.
1171 */
1172 async cancelCurrentRun(reason: CancelReason): Promise<void> {
1173 this.isCancelling = true
1174 this.cancelPromise = Promise.all([...this._onCancelListeners].map(listener => listener(reason)))
1175
1176 await this.cancelPromise.finally(() => (this.cancelPromise = undefined))
1177 await this.runningPromise
1178 }
1179
1180 /** @internal */
1181 async _initBrowserServers(): Promise<void> {

Callers 8

BrowserTestRunnerClass · 0.80
cancelCurrentRunFunction · 0.80
_keypressHandlerFunction · 0.80
onCancelFunction · 0.80
runner.test.tsFile · 0.80
cancel-run.test.tsFile · 0.80
onUserConsoleLogMethod · 0.80
onTestModuleCollectedFunction · 0.80

Calls 2

listenerFunction · 0.85
allMethod · 0.80

Tested by 2

onUserConsoleLogMethod · 0.64
onTestModuleCollectedFunction · 0.64