-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't require files with mocked filesystem #130
Comments
I agree that it would be nice if |
I've been taking a look, but there's a lot of code and I'm not sure I know enough js at this point to make a dent. In any case, here's my (truncated) stacktrace:
the line that's calling it can be found here I'm not sure that there's access to the actual fs while in the |
Awesome, this works like a charm! As for the major version bump, we could get around it by adding Hopefully there's some way to conditionally include the old behavior (though I think your patch is the better default). I'd even be happy with the new behavior locked behind an option as long as it's reachable. |
Ok, I dug a bit further into this. I think the current behavior around So I'm going to publish the changes in #139 as part of a minor release. |
Is there any way you can Context: I'm trying to write tests for a library that internally uses |
@timkendrick if you want to test the behavior of This module is about providing an in-memory filesystem for the functions in the |
Thanks @tschaub, that sounds perfect! |
Hey, just revisiting this. For me, I'm fine to lock into |
Having the same problem with versions after 3.11.0. Would be good to know why this fix was reverted. |
I'm having this issue too. Very annoying... |
Unfortunately I can't use v3 right now as I'm using node 8.6. Any updates on this? |
Why do node developer keep reinventing the wheel.. there are more than a thousand packages that already have the functionality to mock required packages... |
Hey there!
So I'm having sort of a weird problem. I'm testing a function that reads from a file and does stuff with the contents. I'm using
mock-fs
and everything is great. However, one of the modules I'm using changed their code so that there arerequire
statements in functions that get called during the test (in my case, an HTTP request). When the mock is active,require('./blah')
fails because unless I've mirrored that file (which lives > 3 levels down innode_modules
), it's not found. More specific examples are here.Is it currently possible (or possible to add) an option so that the fs is mocked as normal, but all calls to
require
are untouched?The text was updated successfully, but these errors were encountered: