From 04682008428f3dfebf1213b5513b601a0cd990fb Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Thu, 28 Sep 2023 08:36:29 -0700 Subject: [PATCH] fixing commenting --- src/client/testing/testController/common/utils.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/client/testing/testController/common/utils.ts b/src/client/testing/testController/common/utils.ts index 4a0c7078667a..c58850050590 100644 --- a/src/client/testing/testController/common/utils.ts +++ b/src/client/testing/testController/common/utils.ts @@ -328,18 +328,10 @@ export function createEOTPayload(executionBool: boolean): EOTTestPayload { * @returns A tuple where the first item is the parent test name and the second item is the subtest section or `testName` if no subtest section exists. */ export function splitTestNameWithRegex(testName: string): [string, string] { - // The regex pattern has three main components: - // 1. ^(.*?): Matches the beginning of the string and captures everything until the last opening bracket or parenthesis. This captures the parent test name. - // 2. (?:...|...): A non-capturing group containing two patterns separated by an OR (|). - // - \(([^)]+)\): Matches an opening parenthesis, captures everything inside it until the closing parenthesis. This captures the subtest inside parenthesis. - // - \[([^]]+)\]: Matches an opening square bracket, captures everything inside it until the closing square bracket. This captures the subtest inside square brackets. - // 3. ?$: The question mark indicates the preceding non-capturing group is optional. The dollar sign matches the end of the string. - const regex = /^(.*?) ([\[(].*[\])])$/; - const match = testName.match(regex); - // const m2 = regex.exec(testName); - // console.log('m2', m2); // If a match is found, return the parent test name and the subtest (whichever was captured between parenthesis or square brackets). // Otherwise, return the entire testName for the parent and entire testName for the subtest. + const regex = /^(.*?) ([\[(].*[\])])$/; + const match = testName.match(regex); if (match) { return [match[1].trim(), match[2] || match[3] || testName]; }