@reporters/github 1.7.1 → 1.8.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 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const path = require('node:path');
|
|
4
|
+
const { fileURLToPath } = require('node:url');
|
|
4
5
|
const util = require('node:util');
|
|
5
6
|
const { EOL } = require('node:os');
|
|
6
7
|
const core = require('@actions/core');
|
|
@@ -12,11 +13,14 @@ const stack = new StackUtils({ cwd: WORKSPACE, internals: StackUtils.nodeInterna
|
|
|
12
13
|
|
|
13
14
|
const isFile = (name) => name?.startsWith(WORKSPACE);
|
|
14
15
|
|
|
15
|
-
const getRelativeFilePath = (name) => (isFile(name) ? path.relative(WORKSPACE,
|
|
16
|
+
const getRelativeFilePath = (name) => (isFile(name) ? path.relative(WORKSPACE, name) : null);
|
|
16
17
|
|
|
17
18
|
function getFilePath(fileName) {
|
|
18
19
|
if (fileName.startsWith('file://')) {
|
|
19
|
-
return getRelativeFilePath(
|
|
20
|
+
return getRelativeFilePath(fileURLToPath(fileName));
|
|
21
|
+
}
|
|
22
|
+
if (!path.isAbsolute(fileName)) {
|
|
23
|
+
return getRelativeFilePath(path.resolve(fileName) ?? '');
|
|
20
24
|
}
|
|
21
25
|
return getRelativeFilePath(fileName);
|
|
22
26
|
}
|
|
@@ -91,9 +95,10 @@ module.exports = async function githubReporter(source) {
|
|
|
91
95
|
} case 'test:diagnostic':
|
|
92
96
|
if (event.data.file === undefined
|
|
93
97
|
|| event.data.line === undefined
|
|
94
|
-
|| event.data.column === undefined
|
|
98
|
+
|| event.data.column === undefined
|
|
99
|
+
|| (event.data.line === 1 && event.data.column === 1)) {
|
|
95
100
|
diagnostics.push(event.data.message);
|
|
96
|
-
} else {
|
|
101
|
+
} else if (process.env.GITHUB_ACTIONS_REPORTER_VERBOSE) {
|
|
97
102
|
core.notice(event.data.message, extractLocation(event.data));
|
|
98
103
|
}
|
|
99
104
|
break;
|
|
@@ -101,7 +106,7 @@ module.exports = async function githubReporter(source) {
|
|
|
101
106
|
break;
|
|
102
107
|
}
|
|
103
108
|
}
|
|
104
|
-
const
|
|
109
|
+
const formattedDiagnostics = diagnostics.map((d) => {
|
|
105
110
|
const [key, ...rest] = d.split(' ');
|
|
106
111
|
const value = rest.join(' ');
|
|
107
112
|
return [
|
|
@@ -109,14 +114,14 @@ module.exports = async function githubReporter(source) {
|
|
|
109
114
|
DIAGNOSTIC_VALUES[key] ? DIAGNOSTIC_VALUES[key](value) : value,
|
|
110
115
|
];
|
|
111
116
|
});
|
|
112
|
-
core.startGroup(`Test results (${
|
|
113
|
-
core.notice(
|
|
117
|
+
core.startGroup(`Test results (${formattedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.pass)?.[1] ?? counter.pass} passed, ${formattedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.fail)?.[1] ?? counter.fail} failed)`);
|
|
118
|
+
core.notice(formattedDiagnostics.map((d) => d.join(': ')).join(EOL));
|
|
114
119
|
core.endGroup();
|
|
115
120
|
|
|
116
121
|
if (process.env.GITHUB_STEP_SUMMARY) {
|
|
117
122
|
await core.summary
|
|
118
123
|
.addHeading('Test Results')
|
|
119
|
-
.addTable(
|
|
124
|
+
.addTable(formattedDiagnostics)
|
|
120
125
|
.write();
|
|
121
126
|
}
|
|
122
127
|
};
|