Closed flamestream closed 8 years ago
Is there anything in place that will let me achieve the above easily?
No, proxyquire only overrides requires that match the stub list. noCallThru
allows you to replace fs
with {readFile: readFileStub}
while preserving the rest of the methods.
To simulate a module being unavailable, set it's stub value to null
.
Quickly reading the documentation, I was confused by the usage of
noCallThru()
, thinking that it would enable me to do something as follows:test.js
index.js
However, rereading more carefully, it seemed to not be the intent. Is there anything in place that will let me achieve the above easily? For unit testing, it would make sense to explicitly list what can be loaded instead.