( testFilepath: string, code: string, requestMap: any, config: SerializedConfig, filepath: string, fileTags: string[] | undefined, )
| 332 | } |
| 333 | |
| 334 | function createFileTask( |
| 335 | testFilepath: string, |
| 336 | code: string, |
| 337 | requestMap: any, |
| 338 | config: SerializedConfig, |
| 339 | filepath: string, |
| 340 | fileTags: string[] | undefined, |
| 341 | ) { |
| 342 | const { definitions, ast } = astParseFile(testFilepath, code) |
| 343 | const file: ParsedFile = { |
| 344 | filepath, |
| 345 | type: 'suite', |
| 346 | id: /* @__PURE__ */ generateHash(`${testFilepath}${config.name || ''}`), |
| 347 | name: testFilepath, |
| 348 | fullName: testFilepath, |
| 349 | mode: 'run', |
| 350 | tasks: [], |
| 351 | start: ast.start, |
| 352 | end: ast.end, |
| 353 | projectName: config.name, |
| 354 | meta: {}, |
| 355 | pool: 'browser', |
| 356 | file: null!, |
| 357 | tags: fileTags || [], |
| 358 | } |
| 359 | file.file = file |
| 360 | const indexMap = createIndexLocationsMap(code) |
| 361 | const map = requestMap && new TraceMap(requestMap) |
| 362 | let lastSuite: ParsedSuite = file as any |
| 363 | const updateLatestSuite = (index: number) => { |
| 364 | while (lastSuite.suite && lastSuite.end < index) { |
| 365 | lastSuite = lastSuite.suite as ParsedSuite |
| 366 | } |
| 367 | return lastSuite |
| 368 | } |
| 369 | definitions |
| 370 | .sort((a, b) => a.start - b.start) |
| 371 | .forEach((definition) => { |
| 372 | const latestSuite = updateLatestSuite(definition.start) |
| 373 | let mode = definition.mode |
| 374 | if (latestSuite.mode !== 'run') { |
| 375 | // inherit suite mode, if it's set |
| 376 | mode = latestSuite.mode |
| 377 | } |
| 378 | const processedLocation = indexMap.get(definition.start) |
| 379 | let location: { line: number; column: number } | undefined |
| 380 | if (map && processedLocation) { |
| 381 | const originalLocation = originalPositionFor(map, { |
| 382 | line: processedLocation.line, |
| 383 | column: processedLocation.column, |
| 384 | }) |
| 385 | if (originalLocation.column != null) { |
| 386 | verbose?.( |
| 387 | `Found location for`, |
| 388 | definition.type, |
| 389 | definition.name, |
| 390 | `${processedLocation.line}:${processedLocation.column}`, |
| 391 | '->', |
no test coverage detected