From 3c305857f5f443d79c0287f6d172fbde2e5b9126 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Tue, 12 Sep 2023 08:56:43 +0200 Subject: [PATCH] fix(runner): restore leading space in `testNamePattern` (#4103) (#4104) --- packages/runner/src/utils/collect.ts | 3 +-- test/filters/test/testname-pattern.test.ts | 11 ----------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/packages/runner/src/utils/collect.ts b/packages/runner/src/utils/collect.ts index 9eeee4267833..b163bae7f716 100644 --- a/packages/runner/src/utils/collect.ts +++ b/packages/runner/src/utils/collect.ts @@ -46,8 +46,7 @@ export function interpretTaskModes(suite: Suite, namePattern?: string | RegExp, } function getTaskFullName(task: TaskBase): string { - const fullName = task.suite ? getTaskFullName(task.suite) : null - return fullName ? `${fullName} ${task.name}` : task.name + return `${task.suite ? `${getTaskFullName(task.suite)} ` : ''}${task.name}` } export function someTasksAreOnly(suite: Suite): boolean { diff --git a/test/filters/test/testname-pattern.test.ts b/test/filters/test/testname-pattern.test.ts index 40fd9cadc4bf..6a134c6c1615 100644 --- a/test/filters/test/testname-pattern.test.ts +++ b/test/filters/test/testname-pattern.test.ts @@ -30,14 +30,3 @@ test('match by pattern that also matches current working directory', async () => expect(stdout).toMatch('Test Files 1 passed (1)') expect(stdout).not.toMatch('test/example.test.ts') }) - -test('match by test name pattern with ^', async () => { - const { stdout } = await runVitest({ - root: './fixtures', - testNamePattern: '^this', - }, ['filters']) - - expect(stdout).toMatch('✓ test/filters.test.ts > this will pass') - expect(stdout).toMatch('Test Files 1 passed (1)') - expect(stdout).not.toMatch('test/example.test.ts') -})