change directory mapping

This commit is contained in:
Martin Fillafer 2023-03-20 15:47:52 +01:00
parent fb476f0471
commit 599ed4bcba

20
dist/index.js generated vendored
View file

@ -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,18 +2367,21 @@ 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;