diff --git a/src/testUtils.ts b/src/testUtils.ts index 4167927d4..29cad4d1c 100644 --- a/src/testUtils.ts +++ b/src/testUtils.ts @@ -358,7 +358,7 @@ function targetArgs(testconfig: TestConfig): Array { if (testconfig.functions) { if (testconfig.isBenchmark) { - params = ['-bench', util.format('^%s$', testconfig.functions.join('|'))]; + params = ['-bench', util.format('^(%s)$', testconfig.functions.join('|'))]; } else { let testFunctions = testconfig.functions; let testifyMethods = testFunctions.filter(fn => testMethodRegex.test(fn)); @@ -372,10 +372,10 @@ function targetArgs(testconfig: TestConfig): Array { // in running all the test methods, but one of them should call testify's `suite.Run(...)` // which will result in the correct thing to happen if (testFunctions.length > 0) { - params = params.concat(['-run', util.format('^%s$', testFunctions.join('|'))]); + params = params.concat(['-run', util.format('^(%s)$', testFunctions.join('|'))]); } if (testifyMethods.length > 0) { - params = params.concat(['-testify.m', util.format('^%s$', testifyMethods.join('|'))]); + params = params.concat(['-testify.m', util.format('^(%s)$', testifyMethods.join('|'))]); } } return params;