Version 1.0.1. Lightweight utility for capturing and restoring Node.js require() cache state. Enables module-level isolation in tests by clearing cached modules and ensuring fresh loads. Simpler than alternatives like decache as it provides a single snapshot/restore mechanism. Stable with no recent releases; suitable for Node.js environments where ESM is not required.
npm install resnapNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates capturing require cache state, loading modules, then restoring to clear new cache entries.
Call resnap() again to create a new snapshot before restoring multiple times.
Use for CommonJS modules only. For ESM, consider other approaches like import() with URL manipulation.
This is expected behavior; built-in modules are never removed from require cache by resnap.
Use const resnap = require('resnap'); instead of const { resnap } = require('resnap');Call const restore = resnap(); first, then use restore() later.
No dependency data recorded yet.