diff --git a/packages/runner/src/utils/collect.ts b/packages/runner/src/utils/collect.ts index 9eeee4267833..f8302e4a034d 100644 --- a/packages/runner/src/utils/collect.ts +++ b/packages/runner/src/utils/collect.ts @@ -27,8 +27,11 @@ export function interpretTaskModes(suite: Suite, namePattern?: string | RegExp, } } if (t.type === 'test') { - if (namePattern && !getTaskFullName(t).match(namePattern)) - t.mode = 'skip' + if (namePattern) { + const taskFullName = getTaskFullName(t); + if (taskFullName.match(namePattern) || (' ' + taskFullName).match(namePattern)) + t.mode = 'skip' + } } else if (t.type === 'suite') { if (t.mode === 'skip')