Skip to content

Commit

Permalink
fix!: do not exit process if global setup has failed
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed May 14, 2024
1 parent 285865f commit 8158297
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/vitest/src/node/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { dirname, isAbsolute, join, relative, resolve, toNamespacedPath } from '
import type { TransformResult, ViteDevServer, InlineConfig as ViteInlineConfig } from 'vite'
import { ViteNodeRunner } from 'vite-node/client'
import { ViteNodeServer } from 'vite-node/server'
import c from 'picocolors'
import { createBrowserServer } from '../integrations/browser/server'
import type { ProvidedContext, ResolvedConfig, UserConfig, UserWorkspaceConfig, Vitest } from '../types'
import type { Typechecker } from '../typecheck/typechecker'
Expand All @@ -19,7 +18,6 @@ import { WorkspaceVitestPlugin } from './plugins/workspace'
import { createViteServer } from './vite'
import type { GlobalSetupFile } from './globalSetup'
import { loadGlobalSetupFiles } from './globalSetup'
import { divider } from './reporters/renderers/utils'

interface InitializeProjectOptions extends UserWorkspaceConfig {
workspaceConfigPath: string
Expand Down Expand Up @@ -140,9 +138,8 @@ export class WorkspaceProject {
}
}
catch (e) {
this.logger.error(`\n${c.red(divider(c.bold(c.inverse(' Error during global setup '))))}`)
this.logger.printError(e)
process.exit(1)
process.exitCode = 1
throw e
}
}

Expand All @@ -154,9 +151,8 @@ export class WorkspaceProject {
await globalSetupFile.teardown?.()
}
catch (error) {
this.logger.error(`error during global teardown of ${globalSetupFile.file}`, error)
this.logger.printError(error)
process.exitCode = 1
throw error
}
}
}
Expand Down

0 comments on commit 8158297

Please sign in to comment.