require-and-forget

JSON →
library 1.0.1 ·javascript maintenance
verified Jun 7, 2026

Require a Node module and immediately delete it from the module cache, forcing re-evaluation on the next require call. v1.0.1 is the latest stable version (no updates since 2017). Useful for testing scenarios where you need fresh module state (e.g., random values, mutable singletons). Key differentiator: lightweight and focused solely on cache eviction, unlike heavier testing utilities. Works with Node >=6, CommonJS only.