Skip to content

Commit

Permalink
fix: close vite servers on all resolved projects (#5544)
Browse files Browse the repository at this point in the history
  • Loading branch information
surc54 authored Apr 17, 2024
1 parent 9e6417c commit 413ec5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vitest/src/node/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 413ec5e

Please sign in to comment.