MCPcopy
hub / github.com/jestjs/jest / onRunComplete

Method onRunComplete

packages/jest-reporters/src/SummaryReporter.ts:101–140  ·  view source on GitHub ↗
(
    testContexts: Set<TestContext>,
    aggregatedResults: AggregatedResult,
  )

Source from the content-addressed store, hash-verified

99 }
100
101 override onRunComplete(
102 testContexts: Set<TestContext>,
103 aggregatedResults: AggregatedResult,
104 ): void {
105 const {numTotalTestSuites, testResults, wasInterrupted} = aggregatedResults;
106 if (numTotalTestSuites) {
107 const lastResult = testResults.at(-1);
108 // Print a newline if the last test did not fail to line up newlines
109 // similar to when an error would have been thrown in the test.
110 if (
111 !this._globalConfig.verbose &&
112 lastResult &&
113 !lastResult.numFailingTests &&
114 !lastResult.testExecError
115 ) {
116 this.log('');
117 }
118
119 this._printSummary(aggregatedResults, this._globalConfig);
120 this._printSnapshotSummary(
121 aggregatedResults.snapshot,
122 this._globalConfig,
123 );
124
125 let message = getSummary(aggregatedResults, {
126 estimatedTime: this._estimatedTime,
127 seed: this._globalConfig.seed,
128 showSeed: this._globalConfig.showSeed,
129 });
130
131 if (!this._globalConfig.silent) {
132 message += `\n${
133 wasInterrupted
134 ? chalk.bold.red('Test run was interrupted.')
135 : this._getTestSummary(testContexts, this._globalConfig)
136 }`;
137 }
138 this.log(message);
139 }
140 }
141
142 private _printSnapshotSummary(
143 snapshots: SnapshotSummary,

Callers

nothing calls this directly

Calls 5

_printSummaryMethod · 0.95
_printSnapshotSummaryMethod · 0.95
_getTestSummaryMethod · 0.95
getSummaryFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected