-
Notifications
You must be signed in to change notification settings - Fork 30k
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
esm: refactor esm tests out of test/message #41352
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.
🎉😭🙇 Thank you!
Something to consider for all the replacement tests: they're currently checking the full error message (which is already far better than also checking the stacktrace), but I'm thinking that might be overly rigid and brittle. An unimportant change to the error message, say, adding a comma, will cause the test to fail for something we don't care about. I think we only care about specific substrings, like the type of error, file paths if applicable, relevant arguments, etc. The rest is just fluff.
stderr = stderr.toString(); | ||
ok(stderr.includes( | ||
'Error [ERR_MODULE_NOT_FOUND]: Cannot find package \'i-dont-exist\' ' + | ||
'imported from' |
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 think it might be important to include the file path that follows (we want to ensure the error does actually contain it and that it's correct).
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.
There’s no path:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'i-dont-exist' imported from /Users/Geoffrey/Sites/node/
at new NodeError (node:internal/errors:371:5)
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.
Oh weird. (Out of scope) i think there should be
baa3f88
to
30ee141
Compare
This comment has been minimized.
This comment has been minimized.
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
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
30ee141
to
5ce1fd6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5ce1fd6
to
8548e52
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
So I was using node --experimental-loader C:/workspace/node-test-binary-windows-js-suites/node/test/es-module/test-esm-loader-with-syntax-error.mjs And this was erroring, because apparently even in CLI input the path to the entry point (or loader) needs to be a URL, not a file path. Is this what we want? I know within |
input: 'import "./print-error-message"', | ||
// Did you mean to import ../print-error-message.js? | ||
expected: ' ../print-error-message.js?' |
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.
Is this a bug? Shouldn’t the error message say Did you mean to import ./print-error-message.js?
(as in, ./
rather than ../
)?
The same was present in the previous test, so I think that fixing the bug (if this is one) is outside the scope of this PR, but I just wanted to ask if this is a bug that we should file an issue for.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Oow, yes, I like the updated substrings test for the deprecated hooks.
This comment has been minimized.
This comment has been minimized.
Landed in 8dd0658 |
PR-URL: #41352 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: nodejs#41352 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: nodejs#41352 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: nodejs#41352 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Resolves #40920 (comment).
This PR refactors the ESM tests that are currently in
test/message
to instead be with the rest of the ESM tests intest/es-module
. This meant rewriting them from the.out
style to instead spawn child processes. This has two benefits:tools/test.py -J es-module
now does, in fact, run all the ESM tests..out
files’ stack traces.In addition, there were some duplicated import assertion tests that I removed; and I slimmed down a few fixtures that we could do without.
cc @nodejs/modules @nodejs/loaders