From 15c32f06796ad0419b5536258ef97271a98957ed Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Thu, 10 Oct 2024 11:12:57 +0200 Subject: [PATCH] result.attachments always exists --- packages/html-reporter/src/testResultView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/html-reporter/src/testResultView.tsx b/packages/html-reporter/src/testResultView.tsx index f8aa01fd71..c60d6c009b 100644 --- a/packages/html-reporter/src/testResultView.tsx +++ b/packages/html-reporter/src/testResultView.tsx @@ -80,7 +80,7 @@ export const TestResultView: React.FC<{ }> = ({ result, anchor }) => { const { screenshots, videos, traces, otherAttachments, diffs, htmls } = React.useMemo(() => { - const attachments = result?.attachments || []; + const attachments = result.attachments; const screenshots = new Set(attachments.filter(a => getAttachmentCategory(a) === 'screenshot')); const videos = attachments.filter(a => getAttachmentCategory(a) === 'video'); const traces = attachments.filter(a => getAttachmentCategory(a) === 'trace'); @@ -88,7 +88,7 @@ export const TestResultView: React.FC<{ const otherAttachments = attachments.filter(a => getAttachmentCategory(a) === 'other'); const diffs = groupImageDiffs(screenshots); return { screenshots: [...screenshots], videos, traces, otherAttachments, diffs, htmls }; - }, [result]); + }, [result.attachments]); const videoRef = React.useRef(null); const imageDiffRef = React.useRef(null);