@reporters/github
Advanced tools
Comparing version 1.5.4 to 1.6.0
28
index.js
@@ -46,2 +46,17 @@ 'use strict'; | ||
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) { | ||
@@ -71,9 +86,4 @@ if (!process.env.GITHUB_ACTIONS) { | ||
} | ||
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, | ||
@@ -84,6 +94,8 @@ }); | ||
} case 'test:diagnostic': | ||
if (event.data.nesting === 0) { | ||
if (event.data.file === undefined | ||
|| event.data.line === undefined | ||
|| event.data.column === undefined) { | ||
diagnostics.push(event.data.message); | ||
} else { | ||
core.notice(event.data.message, { file: getFilePath(event.data.file) }); | ||
core.notice(event.data.message, extractLocation(event.data)); | ||
} | ||
@@ -90,0 +102,0 @@ break; |
{ | ||
"name": "@reporters/github", | ||
"version": "1.5.4", | ||
"version": "1.6.0", | ||
"description": "A github actions reporter for `node:test`", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6241
108