@reporters/github 1.7.0 → 1.7.2
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 +10 -6
- 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
|
}
|
|
@@ -101,7 +105,7 @@ module.exports = async function githubReporter(source) {
|
|
|
101
105
|
break;
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
|
-
const
|
|
108
|
+
const formattedDiagnostics = diagnostics.map((d) => {
|
|
105
109
|
const [key, ...rest] = d.split(' ');
|
|
106
110
|
const value = rest.join(' ');
|
|
107
111
|
return [
|
|
@@ -109,14 +113,14 @@ module.exports = async function githubReporter(source) {
|
|
|
109
113
|
DIAGNOSTIC_VALUES[key] ? DIAGNOSTIC_VALUES[key](value) : value,
|
|
110
114
|
];
|
|
111
115
|
});
|
|
112
|
-
core.startGroup(`Test results (${
|
|
113
|
-
core.notice(
|
|
116
|
+
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)`);
|
|
117
|
+
core.notice(formattedDiagnostics.map((d) => d.join(': ')).join(EOL));
|
|
114
118
|
core.endGroup();
|
|
115
119
|
|
|
116
120
|
if (process.env.GITHUB_STEP_SUMMARY) {
|
|
117
121
|
await core.summary
|
|
118
122
|
.addHeading('Test Results')
|
|
119
|
-
.addTable(
|
|
123
|
+
.addTable(formattedDiagnostics)
|
|
120
124
|
.write();
|
|
121
125
|
}
|
|
122
126
|
};
|