@reporters/gh 1.2.1 → 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.
Files changed (2) hide show
  1. package/index.js +13 -6
  2. package/package.json +2 -2
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 : '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporters/gh",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "A github actions reporter for `node:test`",
5
5
  "type": "commonjs",
6
6
  "keywords": [
@@ -11,7 +11,7 @@
11
11
  "reporters"
12
12
  ],
13
13
  "dependencies": {
14
- "@actions/core": "^1.10.0",
14
+ "@actions/core": "^2.0.3",
15
15
  "@reporters/github": "^1.11.0"
16
16
  },
17
17
  "files": [