(rawName: string)
| 62 | } |
| 63 | |
| 64 | export function parseRawTestName(rawName: string): { suiteName?: string; testName: string } { |
| 65 | const objcMatch = rawName.match(/^-\[(.+?)\s+(.+)\]$/u); |
| 66 | if (objcMatch) { |
| 67 | return { suiteName: normalizeSuiteName(objcMatch[1]), testName: objcMatch[2] }; |
| 68 | } |
| 69 | |
| 70 | const slashParts = rawName.split('/').filter(Boolean); |
| 71 | if (slashParts.length >= 3) { |
| 72 | return { suiteName: slashParts.slice(0, -1).join('/'), testName: slashParts.at(-1)! }; |
| 73 | } |
| 74 | |
| 75 | if (slashParts.length === 2) { |
| 76 | return { |
| 77 | suiteName: normalizeSuiteName(slashParts[0]), |
| 78 | testName: slashParts[1], |
| 79 | }; |
| 80 | } |
| 81 | |
| 82 | const dotIndex = rawName.lastIndexOf('.'); |
| 83 | if (dotIndex > 0 && dotIndex < rawName.length - 1) { |
| 84 | return { suiteName: rawName.slice(0, dotIndex), testName: rawName.slice(dotIndex + 1) }; |
| 85 | } |
| 86 | |
| 87 | return { testName: rawName }; |
| 88 | } |
| 89 | |
| 90 | export function parseTestCaseLine(line: string): ParsedTestCase | null { |
| 91 | const match = line.match( |
no test coverage detected