You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also tried using .with() and .by(). I also tried using a function which throws an exception but nothing makes the require() throw. When setting the dependency to null, then the require() call simply returns null as well.
My use case is that I have an optional dependency and I want to test the fallback code which handles the case that the dependency is not available.
The text was updated successfully, but these errors were encountered:
Is it possible to simulate the absence of a module with rewiremock? Meaning: make the
require()
call throw aMODULE_NOT_FOUND
exception?proxyquire supports this by simply setting the dependency to
null
in the configuration.I also tried this using rewiremock like this:
I also tried using
.with()
and.by()
. I also tried using a function which throws an exception but nothing makes therequire()
throw. When setting the dependency tonull
, then therequire()
call simply returnsnull
as well.My use case is that I have an optional dependency and I want to test the fallback code which handles the case that the dependency is not available.
The text was updated successfully, but these errors were encountered: