Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: update github_reporter to 1.6.0 #51658

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading