@reporters/gh 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -28,6 +28,7 @@ const reporterUnicodeSymbolMap = {
|
|
|
28
28
|
'test:coverage': '\u2139 ',
|
|
29
29
|
'arrow:right': '\u25B6 ',
|
|
30
30
|
'hyphen:minus': '\uFE63 ',
|
|
31
|
+
'warning:alert': '\u26A0 ',
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
const indentMemo = new Map();
|
|
@@ -112,14 +113,25 @@ class SpecReporter extends Transform {
|
|
|
112
113
|
#formatTestReport(type, data, prefix = '', indentation = '', hasChildren = false, showErrorDetails = true) {
|
|
113
114
|
let color = reporterColorMap[type] ?? 'white';
|
|
114
115
|
let symbol = reporterUnicodeSymbolMap[type] ?? ' ';
|
|
115
|
-
const { skip, todo } = data;
|
|
116
|
+
const { skip, todo, expectFailure } = data;
|
|
116
117
|
const durationMs = data.details?.duration_ms ? styleText(['gray', 'italic'], ` (${formatDuration(data.details.duration_ms)})`, { validateStream: !this.#isGitHubActions }) : '';
|
|
117
118
|
let title = `${data.name}${durationMs}`;
|
|
118
119
|
|
|
119
120
|
if (skip !== undefined) {
|
|
120
121
|
title += ` # ${typeof skip === 'string' && skip.length ? skip : 'SKIP'}`;
|
|
122
|
+
color = 'gray';
|
|
123
|
+
symbol = reporterUnicodeSymbolMap['hyphen:minus'];
|
|
121
124
|
} else if (todo !== undefined) {
|
|
122
125
|
title += ` # ${typeof todo === 'string' && todo.length ? todo : 'TODO'}`;
|
|
126
|
+
if (type === 'test:fail') {
|
|
127
|
+
color = 'yellow';
|
|
128
|
+
symbol = reporterUnicodeSymbolMap['warning:alert'];
|
|
129
|
+
}
|
|
130
|
+
} else if (expectFailure !== undefined) {
|
|
131
|
+
/* c8 ignore next 3 */ // Not yest supported in current node
|
|
132
|
+
title += ' # EXPECTED FAILURE';
|
|
133
|
+
color = 'yellow';
|
|
134
|
+
symbol = reporterUnicodeSymbolMap['warning:alert'];
|
|
123
135
|
}
|
|
124
136
|
|
|
125
137
|
const error = showErrorDetails ? formatError(data.details?.error, indentation) : '';
|
|
@@ -128,11 +140,6 @@ class SpecReporter extends Transform {
|
|
|
128
140
|
err = !error || data.details?.error?.failureType === 'subtestsFailed' ? '' : `\n${error}`;
|
|
129
141
|
}
|
|
130
142
|
|
|
131
|
-
if (skip !== undefined) {
|
|
132
|
-
color = 'gray';
|
|
133
|
-
symbol = reporterUnicodeSymbolMap['hyphen:minus'];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
143
|
const header = `${indentation}${styleText(color, `${symbol}${title}`, { validateStream: !this.#isGitHubActions })}`;
|
|
137
144
|
if (this.#isGitHubActions) {
|
|
138
145
|
const eg = this.#reportedGroup ? endGroup : '';
|