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

Function printErrorsSummary

packages/vitest/src/node/reporters/base.ts:775–801  ·  view source on GitHub ↗
(files: File[], errors: unknown[])

Source from the content-addressed store, hash-verified

773 }
774
775 private printErrorsSummary(files: File[], errors: unknown[]) {
776 const suites = getSuites(files)
777 const tests = getTests(files)
778
779 const failedSuites = suites.filter(i => i.result?.errors)
780 const failedTests = tests.filter(i => i.result?.state === 'fail')
781 const failedTotal = countTestErrors(failedSuites) + countTestErrors(failedTests)
782
783 // TODO: error divider should take into account merged errors for counting
784 let current = 1
785 const errorDivider = () => this.error(`${c.red(c.dim(divider(`[${current++}/${failedTotal}]`, undefined, 1)))}\n`)
786
787 if (failedSuites.length) {
788 this.error(`\n${errorBanner(`Failed Suites ${failedSuites.length}`)}\n`)
789 this.printTaskErrors(failedSuites, errorDivider)
790 }
791
792 if (failedTests.length) {
793 this.error(`\n${errorBanner(`Failed Tests ${failedTests.length}`)}\n`)
794 this.printTaskErrors(failedTests, errorDivider)
795 }
796
797 if (errors.length) {
798 this.ctx.logger.printUnhandledErrors(errors)
799 this.error()
800 }
801 }
802
803 private printLeaksSummary() {
804 const leaks = this.ctx.state.leakSet

Callers

nothing calls this directly

Calls 7

getSuitesFunction · 0.90
getTestsFunction · 0.90
countTestErrorsFunction · 0.90
errorBannerFunction · 0.90
errorMethod · 0.80
printUnhandledErrorsMethod · 0.80
filterMethod · 0.65

Tested by

no test coverage detected