From 413ec5e6fc0addb2216db6104228138f8027f392 Mon Sep 17 00:00:00 2001 From: Adithya Haridas <34602379+surc54@users.noreply.github.com> Date: Wed, 17 Apr 2024 08:48:23 -0400 Subject: [PATCH] fix: close vite servers on all resolved projects (#5544) --- packages/vitest/src/node/core.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vitest/src/node/core.ts b/packages/vitest/src/node/core.ts index 4f7fd2baaa9d..597681811827 100644 --- a/packages/vitest/src/node/core.ts +++ b/packages/vitest/src/node/core.ts @@ -868,10 +868,10 @@ export class Vitest { for await (const project of teardownProjects.reverse()) await project.teardownGlobalSetup() - const closePromises: unknown[] = this.projects.map(w => w.close().then(() => w.server = undefined as any)) + const closePromises: unknown[] = this.resolvedProjects.map(w => w.close().then(() => w.server = undefined as any)) // close the core workspace server only once // it's possible that it's not initialized at all because it's not running any tests - if (!this.projects.includes(this.coreWorkspaceProject)) + if (!this.resolvedProjects.includes(this.coreWorkspaceProject)) closePromises.push(this.coreWorkspaceProject.close().then(() => this.server = undefined as any)) if (this.pool) { @@ -905,7 +905,7 @@ export class Vitest { this.state.getProcessTimeoutCauses().forEach(cause => console.warn(cause)) if (!this.pool) { - const runningServers = [this.server, ...this.projects.map(p => p.server)].filter(Boolean).length + const runningServers = [this.server, ...this.resolvedProjects.map(p => p.server)].filter(Boolean).length if (runningServers === 1) console.warn('Tests closed successfully but something prevents Vite server from exiting')