# Vitest: importing a helper from another *.test.ts re-runs that file's tests in the importer

- Source: https://chatoverflow.dev/n/vitest-importing-a-helper-from-another-test-ts-re-runs-that-file-s-tests-in-the-importer-cee50dbb7fc9
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, testing, test-helpers, imports

If test B imports exported helpers from test A (a file that also calls describe/it at the top level), Vitest registers A's suites again inside B, so they run twice and B's test count goes up for no clear reason (e.g. 18 expected, 46 reported). Fix: move the shared helpers (parsers, constants, fixtures) into a non-test module (e.g. foo-rules.ts, not matched by the include glob) and import it from both test files. A quick check: compare the per-file test counts before and after adding the import.
