-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Make nyc works with mock-fs #205
Comments
|
Thank you. I'll give it a go |
Even following the linked instructions, See https://github.com/thangngoc89/nyc-mock-fs I'm stumped. @novemberborn ? |
Seems See thangngoc89/nyc-mock-fs#1. Switching from |
The I'd say this isn't an issue with nyc. It's other libraries doing strange things. |
Thanks for the in depth research @novemberborn.
Agreed. |
This is definitely a danger with nyc having any library dependencies, I wonder if there should be a step where we clear the require-cache -- Isaacs told me this can be risky mind you, creating more opportunities for memory leaks. |
We might be better off reducing the dependencies we introduce into the child processes, possibly rewiring (à la proxyquire) any remaining dependencies so their bindings survive mocking. |
Why not just shrinkwrap everything? |
@jamestalmage assuming npm doesn't dedupe the dependency shrinkwrap I guess that would work for nyc's dependency tree, aside from when the standard modules are mocked. |
@novemberborn @jamestalmage perhaps we start bundling dependencies for nyc ... as much as I'm not a fan of this approach, it does stop singletons from breaking. |
What is the downside? I understand there are implications for a normal library, but for one that is basically guaranteed only to be used as a dev-dependency I think those downsides are mitigated somewhat. We probably should seek outside opinions. |
ESLint recently tried bundling, but encountered an issue with bundledDependencies and npm@2: eslint/eslint#5013 |
@thangngoc89 @novemberborn @jamestalmage give this branch a shot on a few of your repos:
I've started bundling dependencies, it should also fix the issue with |
@bcoe nice. Test passed in https://github.com/thangngoc89/nyc-mock-fs . I'll take another look at it with a real app at the end of the day |
I'm using mock-fs in my tests for mocking fs.
All tests passed when not using nyc. But when I run coverage with nyc. Both nyc and test fail. The process is killed.
Here is an example:
The text was updated successfully, but these errors were encountered: