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

Method generateReports

packages/coverage-v8/src/provider.ts:103–139  ·  view source on GitHub ↗
(coverageMap: CoverageMap, allTestsRun?: boolean)

Source from the content-addressed store, hash-verified

101 }
102
103 async generateReports(coverageMap: CoverageMap, allTestsRun?: boolean): Promise<void> {
104 if (provider === 'stackblitz') {
105 this.ctx.logger.log(
106 c.blue(' % ')
107 + c.yellow(
108 '@vitest/coverage-v8 does not work on Stackblitz. Report will be empty.',
109 ),
110 )
111 }
112
113 const context = libReport.createContext({
114 dir: this.options.reportsDirectory,
115 coverageMap,
116 watermarks: this.options.watermarks,
117 })
118
119 if (this.hasTerminalReporter(this.options.reporter)) {
120 this.ctx.logger.log(
121 c.blue(' % ') + c.dim('Coverage report from ') + c.yellow(this.name),
122 )
123 }
124
125 for (const reporter of this.options.reporter) {
126 // Type assertion required for custom reporters
127 reports
128 .create(reporter[0] as Parameters<typeof reports.create>[0], {
129 skipFull: this.options.skipFull,
130 projectRoot: this.ctx.config.root,
131 ...reporter[1],
132 })
133 .execute(context)
134 }
135
136 if (this.options.thresholds) {
137 await this.reportThresholds(coverageMap, allTestsRun)
138 }
139 }
140
141 async parseConfigModule(configFilePath: string): Promise<ProxifiedModule<any>> {
142 const contents = await fs.readFile(configFilePath, 'utf8')

Callers

nothing calls this directly

Calls 5

createContextMethod · 0.80
hasTerminalReporterMethod · 0.80
createMethod · 0.80
reportThresholdsMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected