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)
|
||||
continue;
|
||||
try {
|
||||
const attachmentPath = path.relative(this.config.rootDir, attachment.path);
|
||||
if (fs.existsSync(attachmentPath))
|
||||
contents = fs.readFileSync(attachmentPath, { encoding: 'base64' });
|
||||
if (fs.existsSync(attachment.path))
|
||||
contents = fs.readFileSync(attachment.path, { encoding: 'base64' });
|
||||
else
|
||||
systemErr.push(`\nWarning: attachment ${attachmentPath} is missing`);
|
||||
systemErr.push(`\nWarning: attachment ${attachment.path} is missing`);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue