( extraArgs: string[] | undefined, flagName: '-only-testing' | '-skip-testing', )
| 63 | } |
| 64 | |
| 65 | function parseSelectors( |
| 66 | extraArgs: string[] | undefined, |
| 67 | flagName: '-only-testing' | '-skip-testing', |
| 68 | ): TestSelector[] { |
| 69 | if (!extraArgs) { |
| 70 | return []; |
| 71 | } |
| 72 | |
| 73 | const selectors: TestSelector[] = []; |
| 74 | |
| 75 | for (let index = 0; index < extraArgs.length; index += 1) { |
| 76 | const argument = extraArgs[index]; |
| 77 | if (argument === flagName) { |
| 78 | const nextValue = extraArgs[index + 1]; |
| 79 | if (nextValue) { |
| 80 | const selector = parseSelector(nextValue); |
| 81 | if (selector) { |
| 82 | selectors.push(selector); |
| 83 | } |
| 84 | index += 1; |
| 85 | } |
| 86 | continue; |
| 87 | } |
| 88 | |
| 89 | if (argument.startsWith(`${flagName}:`)) { |
| 90 | const selector = parseSelector(argument.slice(flagName.length + 1)); |
| 91 | if (selector) { |
| 92 | selectors.push(selector); |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | return selectors; |
| 98 | } |
| 99 | |
| 100 | function extractAttributeValue(tagBody: string, attributeName: string): string | undefined { |
| 101 | const match = tagBody.match(new RegExp(`${attributeName}\\s*=\\s*"([^"]+)"`)); |
no test coverage detected