From c0ff3c5082dc2b59095423dfb37769392749f8f3 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Fri, 31 May 2024 14:49:01 +0200 Subject: [PATCH] chore: cleanup --- packages/vitest/src/node/workspace.ts | 31 ++++++++------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/packages/vitest/src/node/workspace.ts b/packages/vitest/src/node/workspace.ts index facec9d07448..4b4500d37f41 100644 --- a/packages/vitest/src/node/workspace.ts +++ b/packages/vitest/src/node/workspace.ts @@ -137,34 +137,21 @@ export class WorkspaceProject { this._globalSetups = await loadGlobalSetupFiles(this.runner, this.config.globalSetup) - try { - for (const globalSetupFile of this._globalSetups) { - const teardown = await globalSetupFile.setup?.({ provide: this.provide, config: this.config }) - if (teardown == null || !!globalSetupFile.teardown) - continue - if (typeof teardown !== 'function') - throw new Error(`invalid return value in globalSetup file ${globalSetupFile.file}. Must return a function`) - globalSetupFile.teardown = teardown - } - } - catch (e) { - process.exitCode = 1 - throw e + for (const globalSetupFile of this._globalSetups) { + const teardown = await globalSetupFile.setup?.({ provide: this.provide, config: this.config }) + if (teardown == null || !!globalSetupFile.teardown) + continue + if (typeof teardown !== 'function') + throw new Error(`invalid return value in globalSetup file ${globalSetupFile.file}. Must return a function`) + globalSetupFile.teardown = teardown } } async teardownGlobalSetup() { if (!this._globalSetups) return - for (const globalSetupFile of [...this._globalSetups].reverse()) { - try { - await globalSetupFile.teardown?.() - } - catch (error) { - process.exitCode = 1 - throw error - } - } + for (const globalSetupFile of [...this._globalSetups].reverse()) + await globalSetupFile.teardown?.() } get logger() {