mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47: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
|
||||
errors.splice(maxCount + 1);
|
||||
const annotations = errors.map(e => {
|
||||
const paths = e.path ? [e.path] : e.testRunPaths;
|
||||
const message = [
|
||||
'Failed test found in:',
|
||||
e.testRunPaths.map(p => ` ${p}`).join('\n'),
|
||||
paths.map(p => ` ${p}`).join('\n'),
|
||||
'Error:',
|
||||
ident((0, markdown_utils_1.fixEol)(e.message), ' ')
|
||||
].join('\n');
|
||||
|
|
@ -2366,18 +2367,21 @@ function getBasePath(path, trackedFiles) {
|
|||
if (trackedFiles.includes(path)) {
|
||||
return '';
|
||||
}
|
||||
let max = '';
|
||||
for (const file of trackedFiles) {
|
||||
if (path.endsWith(file) && file.length > max.length) {
|
||||
max = file;
|
||||
const pathParts = path.split('/');
|
||||
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;
|
||||
}
|
||||
const base = path.substr(0, path.length - max.length);
|
||||
return base;
|
||||
}
|
||||
exports.getBasePath = getBasePath;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue