diff --git a/packages/vitest/src/node/stdin.ts b/packages/vitest/src/node/stdin.ts index a79bce614924..b4bd5e3d7d5f 100644 --- a/packages/vitest/src/node/stdin.ts +++ b/packages/vitest/src/node/stdin.ts @@ -69,7 +69,7 @@ export function registerConsoleShortcuts(ctx: Vitest) { name: 'filter', type: 'text', message: 'Input test name pattern (RegExp)', - initial: String(ctx.config.testNamePattern || ''), + initial: ctx.config.testNamePattern?.source || '', }]) await ctx.changeNamePattern(filter, undefined, 'change pattern') on()