On the Tailwind CSS checkout I measured, VitestDedup 0.11.0 made 3,721 test registrations available for comparison, up from 2,169 in 0.10.0. That's a 71.6% increase, with the new analysis taking 1.74 seconds.

I maintain VitestDedup, a static analyzer that finds duplicate Vitest tests and opportunities to replace repeated test code with parameterized cases. Its main use case is an existing suite that has accumulated years of helpers, copied regressions, and different testing conventions.

The goal is to process large amounts of test code quickly. VitestDedup reads source and configuration without executing them, so an initial maintenance review can start from a source checkout. Version 0.11.0 expands the test patterns it understands and improves how it handles comparison context, repeated analysis, and memory.

Results from real repositories

The Tailwind CSS result comes from revision 73e85b23. On Vite, at bc598a6a, comparable registrations grew from 626 to 789, a 26.0% increase. LobeHub gained 1,907 comparable registrations, reaching 68,145.

Here, comparable registrations means extracted registrations minus those reported as unresolved. A registration is a test case recovered from source, including cases expanded from tables and helpers.

Repository Revision Extracted registrations Comparable registrations Analysis time Peak RSS
Tailwind CSS 73e85b23 4,031 3,721 1.74 s 73.12 MiB
LobeHub 5bd25892 70,525 68,145 88.88 s 234.53 MiB
Qwen Code 4bcaf569 104,133 98,096 57.66 s 328.14 MiB

The Qwen Code run processed more than 104,000 test registrations in under a minute. These are end-to-end analysis times for different source trees. Registration count captures part of the workload: the LobeHub run analyzed 6,363 files, while Qwen Code's analyzed 3,994.

Across 228 checkout targets, 0.11.0 extracted 1.12 million test registrations from 116,836 files, with a combined analysis time of 24.8 minutes. Some projects appear in more than one target.

These measurements come from a November 23, 2026 release sweep on an Apple M2 with 24 GiB of memory, using the official Darwin ARM64 binaries. Each version ran once on the same recorded checkout, with the order alternated and other work running on the machine. The command was vitest-dedup . --reporters jsonl; project dependencies were not installed. The figures describe source analysis under those conditions, including unresolved registrations.

From a finding to test.each

The examples below were tested with Node.js 24, Vitest 5.1.0, and VitestDedup 0.11.0. In an existing Vitest project, add this function and its tests. The function applies a bulk discount at ten items.

src/discount.ts:

type DiscountInput = { items: number; total: number; }; export const discount = ({ items, total }: DiscountInput) => ({ total: items >= 10 ? total * 0.9 : total, }); 

tests/discount.test.ts:

import { expect, test } from 'vitest'; import { discount } from '../src/discount'; test('applies no discount at zero items', () => { const result = discount({ items: 0, total: 100 }); expect(result.total).toBe(100); }); test('applies no discount at one item', () => { const result = discount({ items: 1, total: 100 }); expect(result.total).toBe(100); }); test('applies the bulk discount at ten items', () => { const result = discount({ items: 10, total: 100 }); expect(result.total).toBe(90); }); 

From the project root, run:

npx vitest-dedup@0.11.0 . --reporters terminal,json,html 

Open reports/vitest-dedup.html. The reporters also write reports/vitest-dedup.json and print terminal output.

In this isolated example, the report contains two parameterization-candidate warnings. One finding includes these fields:

{ "rule": "parameterization-candidate", "severity": "warning", "verdict": "consolidatable", "titles": [ "applies no discount at zero items", "applies no discount at one item" ] } 

The inputs still represent separate cases. A test.each table preserves them while putting the shared setup and assertion in one place. Replace the three declarations with:

test.each([ { title: 'zero items', items: 0, total: 100, expected: 100 }, { title: 'one item', items: 1, total: 100, expected: 100 }, { title: 'ten items', items: 10, total: 100, expected: 90 }, ])('calculates the total for $title', ({ items, total, expected }) => { const result = discount({ items, total }); expect(result.total).toBe(expected); }); 

Run the project's tests, then rerun the analyzer:

npx vitest run tests/discount.test.ts npx vitest-dedup@0.11.0 . --reporters terminal,json,html 

The refactoring keeps all three tests passing and reduces the parameterization findings from two to zero.

Warnings alone pass the default quality gate. With the default threshold, an unbaselined error-severity finding makes the command exit with code 1. Teams can configure thresholds and baseline policies to choose their gate. The exit-code documentation distinguishes a failed quality gate from an operational error.

Following tests through factories

In a mature suite, a written test(...) declaration can register more than one case. Consider a factory that returns a method:

import { expect, test } from 'vitest'; const make = (value: number) => { return { read: () => test('case', () => expect(value).toBeGreaterThan(0)), }; }; const first = make(1); first.read(); const second = make(1); second.read(); const third = make(2); third.read(); 

That single declaration registers three tests, and all three pass. VitestDedup produces one duplicate-test error for the two invocations that capture 1. The invocation capturing 2 remains distinct and yields one parameterization-candidate warning. The shared case title adds two duplicate-test-name warnings. The analyzer exits with code 1 because of the duplicate-test error.

These findings point to the shared test(...) declaration. Returned-factory support preserves the arguments and suite context of each invocation. It supports methods returned by local or imported factories.

VitestDedup already used an abstract syntax tree, or AST. This release shares more of its results across discovery, comparison, and reporting. These include which function a call reaches, what it returns, and how calls are structured. Sharing those answers keeps the stages consistent as support for JavaScript and TypeScript patterns grows.

Preserving the context that makes tests different

Identical callback bodies can serve different purposes. Version 0.11.0 improves three comparison guards:

  • Repeat schedules. A test with repeats: 2 has two extra invocations to preserve. This change removes a misleading duplicate comparison in Vitest's own browser-trace fixture. The number of comparable registrations for that checkout stayed the same.

  • Hook writes. State written by a sibling suite's beforeEach can remain visible to later tests. The hook comparison guard accounts for whether the relevant state is restored around each test.

  • Activation. The opt-in subsumed-test rule now checks whether the larger test may run before treating its assertions as covering a smaller test.

These changes address concrete sources of false positives. The release comparison also preserved all 577 previously satisfied expectations in the project's 442-case labeled corpus, with no regressions. Those counts describe internal regression fixtures. They do not measure precision on real-world code.

Reusing analysis and sharing memory

Large suites repeat imports and helper calls, and expand tables into test registrations. Reusing structural information reduces the work per registration.

Repeated imports now reuse parsed syntax when both the resolved path and source bytes match. Export analysis still runs in the current import context. On two pinned files in that PR's reproduction, parser calls fell from 66 to 44 and from 68 to 39, with identical reports across paired runs.

Configuration text now shares an allocation across the files it governs. In a 512-file reproduction, sharing one 256 KiB configuration cut peak RSS from about 145 MiB to 16 MiB. Under the reproduction's 64 MiB budget, the analyzer now processes all 1,024 tests. The earlier version stopped after two.

The --max-memory option defaults to 2,048 MiB. It budgets retained analysis data, with a separate RSS check as a backstop. Reports identify incomplete runs when analysis reaches a limit.

Reports escape HTML and strip terminal control sequences. Release archives carry SHA-256 checksums, keyless Sigstore signature bundles, and build provenance. npm installs a prebuilt platform package, and its launcher runs that binary. In 0.11.0, the GitHub Action adds release-download recovery through GitHub's assets API while preserving verification.

Bring the review into regular maintenance

For an existing suite, review the initial report and save accepted findings in a baseline. Baseline creation requires a complete analysis, with the project's dependencies and required generated configuration available:

npx vitest-dedup@0.11.0 . \ --baseline dedup-baseline.json \ --update-baseline 

Commit the reviewed baseline, then gate new findings:

npx vitest-dedup@0.11.0 . \ --baseline dedup-baseline.json \ --fail-on-new 0 

This policy rejects any new finding, including warnings. Existing findings remain visible as baselined.

For this full-suite check, add --fail-on-incomplete to require complete analysis. An incomplete run then exits with code 2. To apply that policy only to resource-limit causes, use --fail-on-incomplete=limits.

For a report focused on a branch's changes, use:

npx vitest-dedup@0.11.0 . \ --baseline dedup-baseline.json \ --changed-since origin/main \ --reporters html 

--changed-since selects findings involving changed files while retaining the surrounding analysis context. When this filter withholds findings, it marks the report incomplete. Keep --fail-on-incomplete on the full-suite check.

The same policies can run in CI; the GitHub Action guide covers integration. A new project can adopt a gate from the start, while a legacy suite can use a baseline to make cleanup incremental.

If you maintain a Vitest suite, start with one report and one finding you can turn into a clearer test. VitestDedup 0.11.0 and its release notes are available on GitHub.

References