MCPcopy
hub / github.com/vitest-dev/vitest / updateTestFilesLocations

Function updateTestFilesLocations

packages/browser/src/client/tester/runner.ts:381–404  ·  view source on GitHub ↗
(files: File[], sourceMaps: Map<string, any>)

Source from the content-addressed store, hash-verified

379}
380
381async function updateTestFilesLocations(files: File[], sourceMaps: Map<string, any>) {
382 const promises = files.map(async (file) => {
383 const traceMap = await getTraceMap(file.filepath, sourceMaps)
384 if (!traceMap) {
385 return null
386 }
387 const updateLocation = (task: Task) => {
388 if (task.location) {
389 const position = getOriginalPosition(traceMap, task.location)
390 if (position) {
391 const { line, column } = position
392 task.location = { line, column: task.each ? column : column + 1 }
393 }
394 }
395 if ('tasks' in task) {
396 task.tasks.forEach(updateLocation)
397 }
398 }
399 file.tasks.forEach(updateLocation)
400 return null
401 })
402
403 await Promise.all(promises)
404}
405
406function getTraceName(task: Task, retryCount: number, repeatsCount: number) {
407 const name = getTestName(task, '-').replace(/[^a-z0-9]/gi, '-')

Callers 1

BrowserTestRunnerClass · 0.85

Calls 2

getTraceMapFunction · 0.85
allMethod · 0.80

Tested by

no test coverage detected