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

Function reportBenchmarkSummary

packages/vitest/src/node/reporters/base.ts:863–892  ·  view source on GitHub ↗
(files: File[])

Source from the content-addressed store, hash-verified

861 }
862
863 reportBenchmarkSummary(files: File[]): void {
864 const benches = getTests(files)
865 const topBenches = benches.filter(i => i.result?.benchmark?.rank === 1)
866
867 this.log(`\n${withLabel('cyan', 'BENCH', 'Summary\n')}`)
868
869 for (const bench of topBenches) {
870 const group = bench.suite || bench.file
871
872 if (!group) {
873 continue
874 }
875
876 const groupName = this.getFullName(group, separator)
877 const project = this.ctx.projects.find(p => p.name === bench.file.projectName)
878
879 this.log(` ${formatProjectName(project)}${bench.name}${c.dim(` - ${groupName}`)}`)
880
881 const siblings = group.tasks
882 .filter(i => i.meta.benchmark && i.result?.benchmark && i !== bench)
883 .sort((a, b) => a.result!.benchmark!.rank - b.result!.benchmark!.rank)
884
885 for (const sibling of siblings) {
886 const number = (sibling.result!.benchmark!.mean / bench.result!.benchmark!.mean).toFixed(2)
887 this.log(c.green(` ${number}x `) + c.gray('faster than ') + sibling.name)
888 }
889
890 this.log('')
891 }
892 }
893
894 private printTaskErrors(tasks: Task[], errorDivider: () => void) {
895 const errorsQueue: [error: TestError | undefined, tests: Task[]][] = []

Callers

nothing calls this directly

Calls 7

getTestsFunction · 0.90
withLabelFunction · 0.90
formatProjectNameFunction · 0.90
getFullNameMethod · 0.80
filterMethod · 0.65
logMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected