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

Method close

packages/vitest/src/node/project.ts:507–527  ·  view source on GitHub ↗

* Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts. * If the resources are needed again, create a new project.

()

Source from the content-addressed store, hash-verified

505 * If the resources are needed again, create a new project.
506 */
507 public close(): Promise<void> {
508 if (!this.closingPromise) {
509 this.closingPromise = Promise.all(
510 [
511 this.vite?.close(),
512 this.typechecker?.stop(),
513 // browser might not be set if it threw an error during initialization
514 (this.browser || this._parent?._parentBrowser?.vite)?.close(),
515 this.clearTmpDir(),
516 ].filter(Boolean),
517 ).then(() => {
518 if (!this.runner.isClosed()) {
519 return this.runner.close()
520 }
521 }).then(() => {
522 this._provided = {} as any
523 this._vite = undefined
524 })
525 }
526 return this.closingPromise
527 }
528
529 /**
530 * Import a file using Vite module runner.

Callers

nothing calls this directly

Calls 4

clearTmpDirMethod · 0.95
allMethod · 0.80
filterMethod · 0.65
stopMethod · 0.45

Tested by

no test coverage detected