MCPcopy Create free account
hub / github.com/nodejs/node / reportTest

Function reportTest

lib/internal/test_runner/reporter/tap.js:78–96  ·  view source on GitHub ↗
(nesting, testNumber, status, name, skip, todo, expectFailure)

Source from the content-addressed store, hash-verified

76}
77
78function reportTest(nesting, testNumber, status, name, skip, todo, expectFailure) {
79 let line = `${indent(nesting)}${status} ${testNumber}`;
80
81 if (name) {
82 line += ` ${tapEscape(`- ${name}`)}`;
83 }
84
85 if (skip !== undefined) {
86 line += ` # SKIP${typeof skip === 'string' && skip.length ? ` ${tapEscape(skip)}` : ''}`;
87 } else if (todo !== undefined) {
88 line += ` # TODO${typeof todo === 'string' && todo.length ? ` ${tapEscape(todo)}` : ''}`;
89 } else if (expectFailure !== undefined) {
90 line += ` # EXPECTED FAILURE${typeof expectFailure === 'string' ? ` ${tapEscape(expectFailure)}` : ''}`;
91 }
92
93 line += '\n';
94
95 return line;
96}
97
98function reportDetails(nesting, data = kEmptyObject, location) {
99 const { error, duration_ms } = data;

Callers 1

tapReporterFunction · 0.85

Calls 2

tapEscapeFunction · 0.85
indentFunction · 0.70

Tested by

no test coverage detected