Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
tests: fix test-require-deps-deprecation for already installed deps#17848
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
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.
This wouldn't be necessary.
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.
Do you mean the comment, or the 'foo' dep too?
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.
The “foo” dep… and as a result the comment too.
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.
nit: I don't think we ever use the $e convention. err is fine.
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.
Damn, sorry, too much PHP lately I think...
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.
To avoid comparing things to the empty string this could be refactored as:
letpath;try{path=require.resolve(m);}catch(err){continue;}assert.notStrictEqual(path,m);Nice trick with require.resolve though :)
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.
Thanks! Correcting ASAP.
All credit should go to @Trott though ;)
3c3ffe8 to 3976872CompareTiriel commented Dec 24, 2017
Done! Thanks! |
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.
Two small nits:
/node/depslooks like a path, so maybe justa build-in module?- Can you add
Ref: https://github.com/nodejs/node/issues/17148to this comment or something like that? Give people a link so they can see the bug that this approach avoids that the simpler approach being replaced doesn't.
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.
True! It's done
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.
Nit: Maybe restore the error message checking in the catch block?
assert.ok(err.toString().startsWith('Error: Cannot find module ')`
Trott left a comment
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.
Thanks for doing this!
Trott commented Dec 24, 2017
Test test-require-deps-deprecation.js was failing when user already had node installed with acorn in require.resolve range. Modified test to acknowledge the possibility and throw only if acorn is found in the deps directory. Fixes: nodejs#17148 Refs: nodejs#17148 (comment)
3976872 to ea3c32eCompareTiriel commented Dec 25, 2017
Done! Thanks! |
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.
Missing period
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.
I’d still like to see a continue here to avoid unneeded assertion in the following line.
Fix following review. Reinstated assertion on error message, and corrected comment. Leaving continu to break loop and avoid unneeded assertions. Fixes: nodejs#17148 Refs: nodejs#17148 (comment)
ea3c32e to 398246fCompareTiriel commented Dec 27, 2017
Sorry for the delay, I was traveling! |
TimothyGu left a comment
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.
LGTM. Thanks for staying with this through the back and forth. I think the comment doesn't disappear as it is technically on a line that still exists in its entirety.
jasnell commented Dec 28, 2017
Tiriel commented Dec 29, 2017
Are these tests know to be this long/to fail, or is there some thing I can fix on my end? |
jasnell commented Dec 29, 2017
CI failures are unrelated. |
maclover7 commented Jan 2, 2018
Test test-require-deps-deprecation.js was failing when user already had node installed with acorn in require.resolve range. Modified test to acknowledge the possibility and throw only if acorn is found in the deps directory. PR-URL: #17848Fixes: #17148 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
apapirovski commented Jan 3, 2018
Landed in 30892c8 |
MylesBorins commented Jan 9, 2018
This does not land cleanly on v9.x, could it be backported? |
Tiriel commented Jan 10, 2018
If it's something I can do myself, I'll gladly give it a try! |
targos commented Jan 10, 2018
@Tiriel thanks! The goal would be to checkout a new branch based on
See https://github.com/nodejs/node/blob/master/doc/guides/backporting-to-release-lines.md for the full guide. |
Tiriel commented Jan 10, 2018
Thanks, I was precisely reading this guide and following it 😄 I'll try these solutions in this order. |
Test test-require-deps-deprecation.js was failing when user already had node installed with acorn in require.resolve range. Modified test to acknowledge the possibility and throw only if acorn is found in the deps directory. Also changed the deprecation test for v9.x: common.expectWarning was failing because the required deps now throw ReferenceErrors when not properly called internally in the right order. PR-URL: nodejs#17848Fixes: nodejs#17148 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
Test test-require-deps-deprecation.js was failing when user already had node installed with acorn in require.resolve range. Modified test to acknowledge the possibility and throw only if acorn is found in the deps directory. Also changed the deprecation test for v9.x: common.expectWarning was failing because the required deps now throw ReferenceErrors when not properly called internally in the right order. Bacport-PR-URL: #18077 PR-URL: #17848Fixes: #17148 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
Merry christmas!
Test test-require-deps-deprecation.js was failing when user already had node
installed with acorn in require.resolve range.
Modified test to acknowledge the possibility and throw only if acorn is
found in the deps directory.
Fixes: #17148
Refs: #17148 (comment)
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test