fix(junit reporter): embedding attachments on report didnt work for tests outside root folder (#15359)
This commit is contained in:
parent
2a805c1f1c
commit
71c08a5dcf
|
|
@ -191,11 +191,10 @@ class JUnitReporter implements Reporter {
|
||||||
if (!attachment.path)
|
if (!attachment.path)
|
||||||
continue;
|
continue;
|
||||||
try {
|
try {
|
||||||
const attachmentPath = path.relative(this.config.rootDir, attachment.path);
|
if (fs.existsSync(attachment.path))
|
||||||
if (fs.existsSync(attachmentPath))
|
contents = fs.readFileSync(attachment.path, { encoding: 'base64' });
|
||||||
contents = fs.readFileSync(attachmentPath, { encoding: 'base64' });
|
|
||||||
else
|
else
|
||||||
systemErr.push(`\nWarning: attachment ${attachmentPath} is missing`);
|
systemErr.push(`\nWarning: attachment ${attachment.path} is missing`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue