$ npm install clear-require
Clear a module from the
requirecache
Useful for testing purposes when you need to freshly require a module.
$ npm install --save clear-require
// foo.js
let i = 0;
module.exports = () => ++i;
const clearRequire = require('clear-require');
require('./foo')();
//=> 1
require('./foo')();
//=> 2
clearRequire('./foo');
require('./foo')();
//=> 1
Type: string
What you would use with require().
Clear all modules from the require cache.
Clear all matching modules from the require cache.
Type: RegExp
Regex to match against the module ID's.
MIT © Sindre Sorhus
© 2010 - cnpmjs.org x YWFE | Home | YWFE