chore: do not print empty attachments in terminal (#12419)

This commit is contained in:
Pavel Feldman 2022-03-01 09:11:53 -08:00 committed by GitHub
parent e0e6b66cbe
commit 96945ab0a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -250,6 +250,9 @@ export function formatFailure(config: FullConfig, test: TestCase, options: {inde
if (includeAttachments) {
for (let i = 0; i < result.attachments.length; ++i) {
const attachment = result.attachments[i];
const hasPrintableContent = attachment.contentType.startsWith('text/') && attachment.body;
if (!attachment.path && !hasPrintableContent)
continue;
resultLines.push('');
resultLines.push(colors.cyan(pad(` attachment #${i + 1}: ${attachment.name} (${attachment.contentType})`, '-')));
if (attachment.path) {