Skip to content

test-must-not-rerun-its-suite

A Test Must Never Re-Run the Suite It Belongs To

Section titled “A Test Must Never Re-Run the Suite It Belongs To”

A test, fixture, or harness MUST NOT invoke a script, npm script, or glob that (transitively) runs the suite containing it: each re-entry spawns more runs, unbounded (a spawnSync of a deploy script that runs bun test).

  • Scripts with a built-in test gate (deploy, release, prepublish) need a recursion-guard env var (e.g. <NAME>_NO_TEST_GATE) that the script honours by skipping its gate, and that the test harness sets before spawning it.
  • Before adding a spawn to a test, read the callee for any test / --test / vitest / jest invocation and for a glob its own path matches. Unsure → stub the callee.
  • Never use ulimit -u as the guard — it counts every process of the user, not the tree.
  • Run any suite that may spawn children under the watchdog and worker caps in skills/t1k-test/SKILL.md.

Incident and watchdog recipe: docs/test-must-not-rerun-its-suite.md.