mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 14:57:09 +01:00
change directory mapping
This commit is contained in:
parent
fb476f0471
commit
599ed4bcba
1 changed files with 13 additions and 9 deletions
20
dist/index.js
generated
vendored
20
dist/index.js
generated
vendored
|
|
@ -1579,9 +1579,10 @@ function getAnnotations(results, maxCount) {
|
||||||
// Limit number of created annotations
|
// Limit number of created annotations
|
||||||
errors.splice(maxCount + 1);
|
errors.splice(maxCount + 1);
|
||||||
const annotations = errors.map(e => {
|
const annotations = errors.map(e => {
|
||||||
|
const paths = e.path ? [e.path] : e.testRunPaths;
|
||||||
const message = [
|
const message = [
|
||||||
'Failed test found in:',
|
'Failed test found in:',
|
||||||
e.testRunPaths.map(p => ` ${p}`).join('\n'),
|
paths.map(p => ` ${p}`).join('\n'),
|
||||||
'Error:',
|
'Error:',
|
||||||
ident((0, markdown_utils_1.fixEol)(e.message), ' ')
|
ident((0, markdown_utils_1.fixEol)(e.message), ' ')
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
@ -2366,17 +2367,20 @@ function getBasePath(path, trackedFiles) {
|
||||||
if (trackedFiles.includes(path)) {
|
if (trackedFiles.includes(path)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
let max = '';
|
|
||||||
for (const file of trackedFiles) {
|
for (const file of trackedFiles) {
|
||||||
if (path.endsWith(file) && file.length > max.length) {
|
const pathParts = path.split('/');
|
||||||
max = file;
|
const originalLength = pathParts.length;
|
||||||
|
const fileParts = file.split('/');
|
||||||
|
while (pathParts.length && pathParts.slice(-1)[0] === fileParts.slice(-1)[0]) {
|
||||||
|
pathParts.pop();
|
||||||
|
fileParts.pop();
|
||||||
|
}
|
||||||
|
// we found some matching path parts
|
||||||
|
if (pathParts.length !== originalLength) {
|
||||||
|
return pathParts.join('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (max === '') {
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
|
||||||
const base = path.substr(0, path.length - max.length);
|
|
||||||
return base;
|
|
||||||
}
|
}
|
||||||
exports.getBasePath = getBasePath;
|
exports.getBasePath = getBasePath;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue