From 547d36bd3570a789d90d6e8b596d8d695f8dc98b Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Tue, 12 Sep 2023 15:55:44 +0200 Subject: [PATCH] fix(runner): another way to allow leading space in `testNamePattern` (#4103) --- packages/runner/src/utils/collect.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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')