@reporters/github 1.5.4 → 1.7.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 +20 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -43,6 +43,21 @@ const DIAGNOSTIC_VALUES = {
|
|
|
43
43
|
duration_ms: (value) => `${Number(value).toFixed(3)}ms`,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
function extractLocation(data) {
|
|
47
|
+
let { line, column, file } = data;
|
|
48
|
+
const error = data.details?.error;
|
|
49
|
+
file = getFilePath(file);
|
|
50
|
+
|
|
51
|
+
if (error) {
|
|
52
|
+
const errorLocation = parseStack(error, file);
|
|
53
|
+
file = getFilePath(errorLocation?.file ?? file) ?? file;
|
|
54
|
+
line = errorLocation?.line ?? line;
|
|
55
|
+
column = errorLocation?.column ?? column;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return { file, startLine: line, startColumn: column };
|
|
59
|
+
}
|
|
60
|
+
|
|
46
61
|
module.exports = async function githubReporter(source) {
|
|
47
62
|
if (!process.env.GITHUB_ACTIONS) {
|
|
48
63
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -67,22 +82,19 @@ module.exports = async function githubReporter(source) {
|
|
|
67
82
|
// no need to re-annotate the file itself
|
|
68
83
|
break;
|
|
69
84
|
}
|
|
70
|
-
let filePath = getFilePath(event.data.file);
|
|
71
|
-
const location = parseStack(error, filePath);
|
|
72
|
-
filePath = getFilePath(location?.file ?? filePath) ?? filePath;
|
|
73
85
|
core.error(util.inspect(error, { colors: false, breakLength: Infinity }), {
|
|
74
|
-
|
|
75
|
-
startLine: location?.line,
|
|
76
|
-
startColumn: location?.column,
|
|
86
|
+
...extractLocation(event.data),
|
|
77
87
|
title: event.data.name,
|
|
78
88
|
});
|
|
79
89
|
counter.fail += 1;
|
|
80
90
|
break;
|
|
81
91
|
} case 'test:diagnostic':
|
|
82
|
-
if (event.data.
|
|
92
|
+
if (event.data.file === undefined
|
|
93
|
+
|| event.data.line === undefined
|
|
94
|
+
|| event.data.column === undefined) {
|
|
83
95
|
diagnostics.push(event.data.message);
|
|
84
96
|
} else {
|
|
85
|
-
core.notice(event.data.message,
|
|
97
|
+
core.notice(event.data.message, extractLocation(event.data));
|
|
86
98
|
}
|
|
87
99
|
break;
|
|
88
100
|
default:
|