[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

fix: correct transform time calculation in merged report (#10570) (#10578)

Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com>

authored by

potatomato
Hiroshi Ogawa
and committed by
GitHub
(Jun 14, 2026, 2:36 PM +0200) b7897289 6f794b11

+12 -6
+3 -2
packages/vitest/src/node/core.ts
··· 642 642 throw new Error('Cannot merge reports when `--reporter=blob` is used. Remove blob reporter from the config first.') 643 643 } 644 644 645 - const { files, errors, coverages, executionTimes } = await readBlobs(this.version, directory || this.config.mergeReports, this.projects) 646 - this.state.blobs = { files, errors, coverages, executionTimes } 645 + const { files, errors, coverages, executionTimes, transformTimes } = await readBlobs(this.version, directory || this.config.mergeReports, this.projects) 646 + this.state.blobs = { files, errors, coverages, executionTimes, transformTimes } 647 + this.state.transformTime = transformTimes.reduce((a, b) => a + b, 0) 647 648 648 649 await this.report('onInit', this) 649 650
+2 -2
test/e2e/test/reporters/merge-reports.test.ts
··· 265 265 file.tasks.push(createTest('some test', file)) 266 266 267 267 await writeBlob( 268 - [version, [file], [], undefined, 1500 * index, {}], 268 + [version, [file], [], undefined, 1500 * index, {}, 2000 * index], 269 269 resolve(`./fixtures/reporters/merge-reports/.vitest/blob/blob-${index}-2.json`), 270 270 ) 271 271 } ··· 279 279 expect(stdout).toContain('✓ first.test.ts (1 test)') 280 280 expect(stdout).toContain('✓ second.test.ts (1 test)') 281 281 282 - expect(stdout).toContain('Duration 4.50s') 282 + expect(stdout).toContain('Duration 4.50s (transform 6.00s') 283 283 expect(stdout).toContain('Per blob 1.50s 3.00s') 284 284 }) 285 285
+7 -2
packages/vitest/src/node/reporters/blob.ts
··· 82 82 coverage, 83 83 executionTime, 84 84 environmentModules, 85 + this.ctx.state.transformTime, 85 86 ] satisfies MergeReport) 86 87 87 88 let outputFile = this.options.outputFile ?? getOutputFile(this.ctx.config, 'blob') ··· 133 134 ) 134 135 } 135 136 const content = await readFile(fullPath, 'utf-8') 136 - const [version, files, errors, coverage, executionTime, environmentModules] = parse( 137 + const [version, files, errors, coverage, executionTime, environmentModules, transformTime] = parse( 137 138 content, 138 139 ) as MergeReport 139 140 if (!version) { ··· 141 142 `vitest.mergeReports() expects all paths in "${blobsDirectory}" to be files generated by the blob reporter, but "${filename}" is not a valid blob file`, 142 143 ) 143 144 } 144 - return { version, files, errors, coverage, file: filename, executionTime, environmentModules } 145 + return { version, files, errors, coverage, file: filename, executionTime, environmentModules, transformTime } 145 146 }) 146 147 const blobs = await Promise.all(promises) 147 148 ··· 209 210 const errors = blobs.flatMap(blob => blob.errors) 210 211 const coverages = blobs.map(blob => blob.coverage) 211 212 const executionTimes = blobs.map(blob => blob.executionTime) 213 + const transformTimes = blobs.map(blob => blob.transformTime) 212 214 213 215 return { 214 216 files, 215 217 errors, 216 218 coverages, 217 219 executionTimes, 220 + transformTimes, 218 221 } 219 222 } 220 223 ··· 223 226 errors: unknown[] 224 227 coverages: unknown[] 225 228 executionTimes: number[] 229 + transformTimes: number[] 226 230 } 227 231 228 232 export type MergeReport = [ ··· 232 236 coverage: unknown, 233 237 executionTime: number, 234 238 environmentModules: MergeReportEnvironmentModules, 239 + transformTime: number, 235 240 ] 236 241 237 242 interface MergeReportEnvironmentModules {