require-without-cache
require without cache
How to use
npm install require-without-cache
var requireWithoutCache = hoge = ; // ...
Using case
It is intended to be used in the spec file.
target file
var model = ; exports { model;};
spec file
var requireWithoutCache = sinon = assert = ; ;
if [1] use normal require
, target
may be cache.
In that case, model
does not replace the stub.
by require.cache
However, you may want to carry out the test without a problem if you use the require-without-cache
.
API
- requireWithoutCache(path, require)
- path {String} filePath
- require {Function} require method
If using custom require
Please define an API for use by the following.
var path = ; { var absolutePath ; // sample require system absolutePath = requireFromAppRoot; return ;}; requireFromAppRoot { var absolutePath = path; return require;} Object;
require-without-cache
need require.resolve
and require.cache