Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: close vite servers on all resolved projects #5544

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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