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: #51658
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
nodejs-github-bot authored and richardlau committed Mar 25, 2024
1 parent c9974f6 commit c7ae13e
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
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
@@ -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 c7ae13e

Please sign in to comment.