Skip to content

Framework awareness

The single biggest false-positive class is test infrastructure. Test files, setup files, and config files are run by your test runner, never imported by production code — so a naive tool flags your whole test suite as dead.

Necro ships a test-runner plugin that does two opposite jobs:

  1. Don’t flag test infrastructure as dead. Test files, setup files, global setup, and config files are treated as entry points.
  2. Don’t flag test-only production code as alive. A util used only by tests is production-dead — the test-only verdict.

The plugin activates automatically when it detects a test runner — via a dependency (vitest, jest, @jest/core, mocha, @playwright/test), a config file (vitest.config.*, jest.config.*), or a jest key in package.json.

The #1 self-destruct is assuming **/*.test.ts when your repo uses **/*.spec.ts. Necro reads your actual config instead:

  • jest — runs jest --showConfig (when you allow it), falling back to parsing jest.config.* or package.json#jest.
  • vitest — parses the test block of vitest.config.* / vite.config.*.

From that it learns your test match globs, setup files, and global setup, and marks them as test entries. Resolved config is cached.

Plugins for Next.js, NestJS (DI decorators), and template-based frameworks are planned. When no plugin matches a framework, candidates degrade to maybe rather than being falsely killed.