From 12e85a7c1b3e82e3a16b5ea33b070c7fea2b13a2 Mon Sep 17 00:00:00 2001 From: faysou Date: Mon, 23 Nov 2026 12:02:13 +0000 Subject: [PATCH] test(vcs): check Git Log graph options as separate equivalence cases (#5424) The Git Log graph-equivalence test compares layouts for eight option combinations, each with five fragment configurations. Running all 40 comparisons in one Vitest case exceeded the five-second timeout on shared Linux runners. Give each option combination its own test for histories with and without refs. Each case still compares the complete layout with the dense reference implementation for all five fragment configurations and the same 2,400 commits. Co-authored-by: faysou <893862+faysou@users.noreply.github.com> --- .../vcs/__tests__/logGraphEquivalence.test.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/features/vcs/__tests__/logGraphEquivalence.test.ts b/src/features/vcs/__tests__/logGraphEquivalence.test.ts index bc4c4eeeb..4c565b7c2 100644 --- a/src/features/vcs/__tests__/logGraphEquivalence.test.ts +++ b/src/features/vcs/__tests__/logGraphEquivalence.test.ts @@ -160,24 +160,27 @@ describe("computeGraph lane slots", () => { }); }); -describe("presentLogGraph", () => { +describe.each([true, false])("presentLogGraph (refs: %s)", (withRefs) => { const optionCombinations: GraphOptions[] = [false, true].flatMap((collapseLinear) => [false, true].flatMap((linearizeMerges) => [false, true].map((longEdges) => ({ collapseLinear, linearizeMerges, longEdges })), ), ); - it.each([true, false])("keeps every option and fragment combination unchanged (refs: %s)", (withRefs) => { - const commits = history(2400, withRefs); - const head = new Set([commitKey(commits[0]!)]); - const variants = fragmentVariants(commits); - for (const options of optionCombinations) + const commits = history(2400, withRefs); + const head = new Set([commitKey(commits[0]!)]); + const variants = fragmentVariants(commits); + + it.each(optionCombinations)( + "keeps fragments equivalent (collapseLinear: $collapseLinear, linearizeMerges: $linearizeMerges, longEdges: $longEdges)", + (options) => { for (const [name, fragments] of Object.entries(variants)) { vi.mocked(computeGraph).mockImplementation(real); const got = presentLogGraph(commits, options, fragments, head); vi.mocked(computeGraph).mockImplementation(referenceComputeGraph); const want = presentLogGraph(commits, options, fragments, head); - expect(got, `${JSON.stringify(options)} ${name}`).toEqual(want); + expect(got, name).toEqual(want); } - }); + }, + ); });