Skip to content

Commit

Permalink
fix(runner): restore leading space in testNamePattern (#4103) (#4104)
Browse files Browse the repository at this point in the history
  • Loading branch information
segrey committed Sep 12, 2023
1 parent 91853bb commit 3c30585
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
3 changes: 1 addition & 2 deletions packages/runner/src/utils/collect.ts
Expand Up @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions test/filters/test/testname-pattern.test.ts
Expand Up @@ -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')
})

0 comments on commit 3c30585

Please sign in to comment.