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 node core modules work on modulePathIgnorePatterns #122
Make node core modules work on modulePathIgnorePatterns #122
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
return this._configShouldMockModuleNames[moduleName] = false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You leaked a new line here, remove it with the next commit.
@skidding the existing tests pass. |
@@ -123,7 +123,6 @@ function Loader(config, environment, resourceMap) { | |||
this._reverseDependencyMap = null; | |||
this._shouldAutoMock = true; | |||
this._configShouldMockModuleNames = {}; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave little stuff like this as-is so that git blame signal remains useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffmo addressed spacing.
any progress on this? |
I included this fix and got this instead:
Running on Windows with the following versions:
Any thoughts on that or someone else with the same issue? |
I applied this fix to master (v0.2.1) and still get the same bug, though the fix works just fine against v0.1.18. Are there any updates on this PR and the issue it addresses? |
@jeffkole hey....this was forever ago. I need to figure out what I was doing then and how i would fix it now. Cheers. |
Thank you |
@@ -591,7 +591,7 @@ Loader.prototype._shouldMock = function(currPath, moduleName) { | |||
this._configShouldMockModuleNames[moduleName] = true; | |||
for (var i = 0; i < this._unmockListRegExps.length; i++) { | |||
unmockRegExp = this._unmockListRegExps[i]; | |||
if (unmockRegExp.test(modulePath)) { | |||
if (unmockRegExp.test(modulePath) || modulePath === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this just never mock node built-ins?
Instead, shouldn't this be something like
unmockRegExp.test(modulePath) || (modulePath === null && unmockRegExp.test(moduleName)
?
Otherwise I think this will just always mark node built-ins as unmocked, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes...this makes the core modules no longer be ignored.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
This would be a very good fix, as this is a bug that can be a bit frustrating very early in the implementation process. |
+1 |
@adaschevici are you still interested in providing a proper fix for this issue? |
@cpojer looking into it as the code has shifted around quite a bit since I submitted this pull request. |
Hi guys, Not sure but this has evolved over time and as far as I can tell the modulePathIgnorePatterns is no longer used and the initlal problem was fixed, and i believe the new requirements should be something like: Make the modulePathIgnorePatterns use aliases in the node_modules. (for example in jquery) |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
...ock #106
This is not the best fix but it solves the problem for node modules.
I would appreciate some feedback on ways to improve it.
Need to write the tests still.