From 1dbf5140c1fef445bffd02937fa23feb163c4bec Mon Sep 17 00:00:00 2001 From: Vladimir Date: Sat, 4 Jan 2025 11:37:42 +0100 Subject: [PATCH] fix: `cancelCurrentRun` awaits `runningPromise` (#7168) --- packages/vitest/src/node/core.ts | 1 + packages/vitest/src/node/stdin.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vitest/src/node/core.ts b/packages/vitest/src/node/core.ts index 8375ea9b5..a46008e3c 100644 --- a/packages/vitest/src/node/core.ts +++ b/packages/vitest/src/node/core.ts @@ -800,6 +800,7 @@ export class Vitest { async cancelCurrentRun(reason: CancelReason): Promise { this.isCancelling = true await Promise.all(this._onCancelListeners.splice(0).map(listener => listener(reason))) + await this.runningPromise } /** @internal */ diff --git a/packages/vitest/src/node/stdin.ts b/packages/vitest/src/node/stdin.ts index e12d39710..7b66529a6 100644 --- a/packages/vitest/src/node/stdin.ts +++ b/packages/vitest/src/node/stdin.ts @@ -61,7 +61,6 @@ export function registerConsoleShortcuts( process.exitCode = 130 await ctx.cancelCurrentRun('keyboard-input') - await ctx.runningPromise } return ctx.exit(true) } -- 2.51.2