From e18589818e1a4dba2870b89cfe3b4eacb04301cb Mon Sep 17 00:00:00 2001 From: AriPerkkio Date: Sun, 15 Oct 2023 15:36:12 +0300 Subject: [PATCH] fix(cli): do not capture `stdin` when in run mode --- packages/vitest/src/node/cli-api.ts | 2 +- packages/vitest/src/node/stdin.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/vitest/src/node/cli-api.ts b/packages/vitest/src/node/cli-api.ts index a6456138948f..dc49590e3dae 100644 --- a/packages/vitest/src/node/cli-api.ts +++ b/packages/vitest/src/node/cli-api.ts @@ -78,7 +78,7 @@ export async function startVitest( } let stdinCleanup - if (process.stdin.isTTY) + if (process.stdin.isTTY && ctx.config.watch) stdinCleanup = registerConsoleShortcuts(ctx) ctx.onServerRestart((reason) => { diff --git a/packages/vitest/src/node/stdin.ts b/packages/vitest/src/node/stdin.ts index f4b3b82dc8ef..298bf1c019f8 100644 --- a/packages/vitest/src/node/stdin.ts +++ b/packages/vitest/src/node/stdin.ts @@ -49,10 +49,6 @@ export function registerConsoleShortcuts(ctx: Vitest) { return } - // Other keys are for watch mode only - if (!ctx.config.watch) - return - const name = key?.name if (ctx.runningPromise) {