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

Method _reportFileTask

packages/vitest/src/node/core.ts:656–684  ·  view source on GitHub ↗

@internal

(file: File)

Source from the content-addressed store, hash-verified

654
655 /** @internal */
656 public async _reportFileTask(file: File): Promise<void> {
657 const project = this.getProjectByName(file.projectName || '')
658 await this._testRun.enqueued(project, file).catch((error) => {
659 this.state.catchError(serializeValue(error), 'Unhandled Reporter Error')
660 })
661 await this._testRun.collected(project, [file]).catch((error) => {
662 this.state.catchError(serializeValue(error), 'Unhandled Reporter Error')
663 })
664
665 const logs: UserConsoleLog[] = []
666
667 const { packs, events } = convertTasksToEvents(file, (task) => {
668 if (task.logs) {
669 logs.push(...task.logs)
670 }
671 })
672
673 logs.sort((log1, log2) => log1.time - log2.time)
674
675 for (const log of logs) {
676 await this._testRun.log(log).catch((error) => {
677 this.state.catchError(serializeValue(error), 'Unhandled Reporter Error')
678 })
679 }
680
681 await this._testRun.updated(packs, events).catch((error) => {
682 this.state.catchError(serializeValue(error), 'Unhandled Reporter Error')
683 })
684 }
685
686 async collect(filters?: string[], options?: { staticParse?: boolean; staticParseConcurrency?: number }): Promise<TestRunResult> {
687 return this._traces.$('vitest.collect', async (collectSpan) => {

Callers 2

mergeReportsMethod · 0.95
onMessageFunction · 0.80

Calls 9

getProjectByNameMethod · 0.95
serializeValueFunction · 0.90
convertTasksToEventsFunction · 0.90
enqueuedMethod · 0.80
catchErrorMethod · 0.80
collectedMethod · 0.80
sortMethod · 0.45
logMethod · 0.45
updatedMethod · 0.45

Tested by

no test coverage detected