Skip to content

Commit

Permalink
tools: update github_reporter to 1.6.0
Browse files Browse the repository at this point in the history
PR-URL: nodejs#51658
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
nodejs-github-bot authored and rdw-msft committed Feb 9, 2024
1 parent 5297be8 commit 9844869
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
23 changes: 15 additions & 8 deletions tools/github_reporter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19156,6 +19156,18 @@ var DIAGNOSTIC_KEYS = {
var DIAGNOSTIC_VALUES = {
duration_ms: (value) => `${Number(value).toFixed(3)}ms`
};
function extractLocation(data) {
let { line, column, file } = data;
const error = data.details?.error;
file = getFilePath(file);
if (error) {
const errorLocation = parseStack(error, file);
file = getFilePath(errorLocation?.file ?? file) ?? file;
line = errorLocation?.line ?? line;
column = errorLocation?.column ?? column;
}
return { file, startLine: line, startColumn: column };
}
module.exports = async function githubReporter(source) {
if (!process.env.GITHUB_ACTIONS) {
for await (const _ of source)
Expand All @@ -19178,23 +19190,18 @@ module.exports = async function githubReporter(source) {
if (error?.code === "ERR_TEST_FAILURE" && error?.failureType === "subtestsFailed") {
break;
}
let filePath = getFilePath(event.data.file);
const location = parseStack(error, filePath);
filePath = getFilePath(location?.file ?? filePath) ?? filePath;
core.error(util.inspect(error, { colors: false, breakLength: Infinity }), {
file: filePath,
startLine: location?.line,
startColumn: location?.column,
...extractLocation(event.data),
title: event.data.name
});
counter.fail += 1;
break;
}
case "test:diagnostic":
if (event.data.nesting === 0) {
if (event.data.file === void 0 || event.data.line === void 0 || event.data.column === void 0) {
diagnostics.push(event.data.message);
} else {
core.notice(event.data.message, { file: getFilePath(event.data.file) });
core.notice(event.data.message, extractLocation(event.data));
}
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion tools/github_reporter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reporters/github",
"version": "1.5.4",
"version": "1.6.0",
"description": "A github actions reporter for `node:test`",
"type": "commonjs",
"keywords": [
Expand Down

0 comments on commit 9844869

Please sign in to comment.