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) }