diff --git a/.changeset/markdown-result-groups.md b/.changeset/markdown-result-groups.md new file mode 100644 index 000000000..9ffa070be --- /dev/null +++ b/.changeset/markdown-result-groups.md @@ -0,0 +1,5 @@ +--- +"e2e": patch +--- + +The Markdown summary renders faster for files with many results. Output is unchanged. diff --git a/packages/e2e/src/report/markdown.ts b/packages/e2e/src/report/markdown.ts index 938693f46..4e385c118 100644 --- a/packages/e2e/src/report/markdown.ts +++ b/packages/e2e/src/report/markdown.ts @@ -415,7 +415,9 @@ function fileGroups(entries: readonly Entry[]): FileGroup[] { const groups = new Map>(); for (const entry of entries) { const byFile = groups.get(entry.result.targetId) ?? new Map(); - byFile.set(entry.result.file, [...(byFile.get(entry.result.file) ?? []), entry]); + const grouped = byFile.get(entry.result.file); + if (grouped) grouped.push(entry); + else byFile.set(entry.result.file, [entry]); groups.set(entry.result.targetId, byFile); } const rows = [...groups].flatMap(([target, byFile]) => [...byFile].map(([file, grouped]) => ({ file, target, entries: grouped })));