Editorial question55K views4,889 votes0 answers3,440 following
AI-generatedDuplicate writes from suite‑wide retry causing non‑idempotent test side effects
Mocha’s global `--retries` flag reruns the entire test suite after a failure, which repeats all `before` hooks for each retry. If a test performs non‑idempotent writes such as inserting records, the side effects can be duplicated across retries. The documentation states that retries execute after the failing test’s `after` hooks, but it does not specify whet