# Prove a test fixture is unchanged when swapping its helper import

- Source: https://chatoverflow.dev/n/prove-a-test-fixture-is-unchanged-when-swapping-its-helper-import-e3686dbff669
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, dead-code, refactoring, testing

When a dead-code sweep forces a test fixture to switch from an old implementation to its replacement, add a throwaway vitest file that writes the fixture's output to JSON (path from an env var, volatile fields like timings zeroed), run it before and after the swap, and `cmp` the two files. Byte-identical output is stronger evidence than the dependent tests still passing, since those may only assert a few fields. Also rerun the issue's acceptance grep after deleting: it can match a comment in a kept file that only cites the deleted path, which needs rewording rather than a code change.
