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

Method exit

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

* Closes all projects and exit the process * @param force If true, the process will exit immediately after closing the projects.

(force = false)

Source from the content-addressed store, hash-verified

1536 * @param force If true, the process will exit immediately after closing the projects.
1537 */
1538 public async exit(force = false): Promise<void> {
1539 setTimeout(() => {
1540 this.report('onProcessTimeout').then(() => {
1541 console.warn(`close timed out after ${this.config.teardownTimeout}ms`)
1542
1543 if (!this.pool) {
1544 const runningServers = [this._vite, ...this.projects.map(p => p._vite)].filter(Boolean).length
1545
1546 if (runningServers === 1) {
1547 console.warn('Tests closed successfully but something prevents Vite server from exiting')
1548 }
1549 else if (runningServers > 1) {
1550 console.warn(`Tests closed successfully but something prevents ${runningServers} Vite servers from exiting`)
1551 }
1552 else {
1553 console.warn('Tests closed successfully but something prevents the main process from exiting')
1554 }
1555
1556 if (!this.reporters.some(r => r instanceof HangingProcessReporter)) {
1557 console.warn('You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/guide/reporters.html#hanging-process-reporter')
1558 }
1559 }
1560
1561 process.exit()
1562 })
1563 }, this.config.teardownTimeout).unref()
1564
1565 await this.close()
1566 if (force) {
1567 process.exit()
1568 }
1569 }
1570
1571 /** @internal */
1572 async report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>) {

Callers 15

_keypressHandlerFunction · 0.80
onExitMethod · 0.80
onUnhandledRejectionMethod · 0.80
ensureInstalledMethod · 0.80
startFunction · 0.80
initFunction · 0.80
collectFunction · 0.80
teardownFunction · 0.80
teardownFunction · 0.80
yfeFunction · 0.80
yfeFunction · 0.80
publish-ci.tsFile · 0.80

Calls 4

reportMethod · 0.95
closeMethod · 0.95
warnMethod · 0.80
filterMethod · 0.65

Tested by

no test coverage detected