MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / result

Method result

lib/mocha/cli.js:188–334  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

186 }
187
188 async result() {
189 try {
190 const Container = await getContainer()
191 Container.result().addStats(this.stats)
192 Container.result().finish()
193
194 const stats = Container.result().stats
195 console.log()
196
197 // passes
198 if (stats.failures) {
199 output.print(output.styles.bold('-- FAILURES:'))
200 }
201
202 const failuresLog = []
203
204 // failures
205 if (stats.failures) {
206 for (const test of this.failures) {
207 if (test.err && typeof test.err.fetchDetails === 'function') {
208 try {
209 await test.err.fetchDetails()
210 } catch (e) {
211 // ignore fetch errors
212 }
213 }
214 }
215
216 // append step traces
217 const Container = await getContainer()
218 this.failures = this.failures.map(test => {
219 // we will change the stack trace, so we need to clone the test
220 const err = test.err
221
222 let log = ''
223 let originalMessage = err.message
224
225 if (err instanceof AssertionFailedError) {
226 err.message = err.inspect()
227 }
228
229 // multi-line error messages (for Playwright)
230 if (err.message && err.message.includes('\n')) {
231 const lines = err.message.split('\n')
232 const truncatedLines = lines.slice(0, 5)
233 if (lines.length > 5) {
234 truncatedLines.push('...')
235 }
236 err.message = truncatedLines.join('\n').replace(/^/gm, ' ').trim()
237 }
238
239 // add new line before the message
240 err.message = '\n ' + err.message
241
242 // explicitly show file with error
243 if (test.file) {
244 log += `\n${output.styles.basic(figures.circle)} ${output.styles.section('File:')} file://${test.file}\n`
245 }

Callers 12

doneMethod · 0.45
runTestsMethod · 0.45
doneMethod · 0.45
isFailedMethod · 0.45
_listenWorkerEventsMethod · 0.45
_finishRunMethod · 0.45
printResultsMethod · 0.45
constructorMethod · 0.45
messageHandlerFunction · 0.45
initializeListenersFunction · 0.45
result.jsFile · 0.45
worker_test.jsFile · 0.45

Calls 15

fixErrorStackFunction · 0.90
cloneTestFunction · 0.90
getContainerFunction · 0.85
addStatsMethod · 0.80
finishMethod · 0.80
logMethod · 0.80
fetchDetailsMethod · 0.80
includesMethod · 0.80
pushMethod · 0.80
lineMethod · 0.80
entriesMethod · 0.80
tsFileMappingMethod · 0.80

Tested by

no test coverage detected