-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
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
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:
let path;
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
3976872
Compare
|
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!
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
ea3c32e
Compare
|
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
398246f
Compare
|
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.
|
Are these tests know to be this long/to fail, or is there some thing I can fix on my end? |
|
CI failures are unrelated. |
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: #17848 Fixes: #17148 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 30892c8 |
|
This does not land cleanly on v9.x, could it be backported? |
|
If it's something I can do myself, I'll gladly give it a try! |
|
@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. |
|
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#17848 Fixes: nodejs#17148 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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: #17848 Fixes: #17148 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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