( varsPath: string, basePath: string, )
| 245 | } |
| 246 | |
| 247 | function getStandaloneTestsFileMetadata( |
| 248 | varsPath: string, |
| 249 | basePath: string, |
| 250 | ): StandaloneTestsFileMetadata { |
| 251 | const resolvedVarsPath = path.resolve(basePath, varsPath.replace(/^file:\/\//, '')); |
| 252 | // Split on the last colon to handle Windows drive letters correctly |
| 253 | const colonCount = resolvedVarsPath.split(':').length - 1; |
| 254 | const lastColonIndex = resolvedVarsPath.lastIndexOf(':'); |
| 255 | |
| 256 | // For Windows paths, we need to account for the drive letter colon |
| 257 | const isWindowsPath = /^[A-Za-z]:/.test(resolvedVarsPath); |
| 258 | const effectiveColonCount = isWindowsPath ? colonCount - 1 : colonCount; |
| 259 | |
| 260 | if (effectiveColonCount > 1) { |
| 261 | throw new Error(`Too many colons. Invalid test file script path: ${varsPath}`); |
| 262 | } |
| 263 | |
| 264 | const pathWithoutFunction = |
| 265 | lastColonIndex > 1 ? resolvedVarsPath.slice(0, lastColonIndex) : resolvedVarsPath; |
| 266 | const maybeFunctionName = |
| 267 | lastColonIndex > 1 ? resolvedVarsPath.slice(lastColonIndex + 1) : undefined; |
| 268 | const fileExtension = parsePath(pathWithoutFunction).ext.slice(1); |
| 269 | // For xlsx/xls files, remove sheet specifier (e.g., #Sheet1) from extension |
| 270 | const extensionWithoutSheet = fileExtension.split('#')[0]; |
| 271 | |
| 272 | return { |
| 273 | resolvedVarsPath, |
| 274 | pathWithoutFunction, |
| 275 | maybeFunctionName, |
| 276 | fileExtension, |
| 277 | extensionWithoutSheet, |
| 278 | }; |
| 279 | } |
| 280 | |
| 281 | async function readJavascriptTestCases( |
| 282 | pathWithoutFunction: string, |
no test coverage detected
searching dependent graphs…