Flush the Node.js internal require cache, ensuring modules are re-evaluated fresh on subsequent require() calls. Current version 1.0.1, last updated 2017, no active development or known releases since. Key differentiator: simple, single-function library that clears the entire module cache recursively, useful for writing isolated tests in Mocha or AVA. Minimal alternative to more feature-rich cache-busting tools or manual cache management.
npm install flush-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use flush-cache to clear the require cache before each Mocha test, ensuring fresh module imports.
Avoid flushing cache in production code; only use in test setup. Manually preserve specific modules if needed by re-requiring them after flush.
Consider using modern alternatives like 'jest.isolateModules()' for testing, or manually manage cache with 'delete require.cache[modulePath]'.
Check if the ignored list covers your dependencies. If a module breaks, consider an alternative or manual cache clearing.
Ensure npm install --save-dev flush-cache is run. Use in test scripts only, not in production entry points.
Use const flush = require('flush-cache') instead of import flush from 'flush-cache'.No dependency data recorded yet.