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 usually like to pass all environment bound interfaces as a parameter, including fs.
Here is a simple Example:
import*asfsfrom"fs";functiondoSomething(something,fsEnv=fs){// Do something with fsEnv}
With this practice there is no necessity to temporarily disable an interface globally, which can cause some very unexpected issues (one of such issues is seen on the Readme with Jest Snapshots).
Is there a possibility to create a fs mock without actually messing with the origina fs?
With the example above, I would like to implement tests like this:
After looking into the source-code, it doesn't seem to be possible currently.
With a bit of refactoring however, this feature could be integrated though, by adding a doNotPatch option and return a mocked fs map that implements all interfaces that fs exports.
I usually like to pass all environment bound interfaces as a parameter, including fs.
Here is a simple Example:
With this practice there is no necessity to temporarily disable an interface globally, which can cause some very unexpected issues (one of such issues is seen on the Readme with Jest Snapshots).
Is there a possibility to create a fs mock without actually messing with the origina fs?
With the example above, I would like to implement tests like this:
Without needing to call restore on anything.
The text was updated successfully, but these errors were encountered: