@reporters/github
Advanced tools
Comparing version 1.5.0 to 1.5.1
16
index.js
@@ -13,4 +13,11 @@ const path = require('node:path'); | ||
const getFilePath = (name) => (isFile(name) ? path.relative(WORKSPACE, require.resolve(name) ?? '') : null); | ||
const getRelativeFilePath = (name) => (isFile(name) ? path.relative(WORKSPACE, require.resolve(name) ?? '') : null); | ||
function getFilePath(fileName) { | ||
if (fileName.startsWith('file://')) { | ||
return getRelativeFilePath(new URL(fileName).pathname); | ||
} | ||
return getRelativeFilePath(fileName); | ||
} | ||
const parseStack = (error, file) => { | ||
@@ -20,3 +27,2 @@ const err = error?.code === 'ERR_TEST_FAILURE' ? error?.cause : error; | ||
const line = stackLines.find((l) => l.includes(file)) ?? stackLines[0]; | ||
return line ? stack.parseLine(line) : null; | ||
@@ -64,5 +70,7 @@ }; | ||
} | ||
const location = parseStack(error, getFilePath(event.data.file)); | ||
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: location?.file ?? getFilePath(event.data.file), | ||
file: filePath, | ||
startLine: location?.line, | ||
@@ -69,0 +77,0 @@ startColumn: location?.column, |
{ | ||
"name": "@reporters/github", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "A github actions reporter for `node:test`", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
5949
98