-
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
test: invalid package.json causes error when require()ing in directory #10044
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.
LGTM if CI is ✅ . Might be slightly better if the RegExp used ^
and $
to match the whole message, but I'm fine with this as is.
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, but I'd like another CI run: https://ci.nodejs.org/job/node-test-pull-request/5140/
@@ -69,6 +69,9 @@ assert.strictEqual(threeFolder, threeIndex); | |||
assert.notStrictEqual(threeFolder, three); | |||
|
|||
console.error('test package.json require() loading'); | |||
assert.throws(function() { | |||
require('../fixtures/packages/invalid'); | |||
}, /package.json: Unexpected token/); |
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.
Would be better to test the entire error message here.
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.
What is the benefit of full text message checking?
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.
We treat changes to error messages as breaking changes. So, it's a good way to detect if anything changes.
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.
small nit but LGTM
Requiring a file from a directory that contains an invalid package.json file should throw an error.
I made the RegExp more strict. CI: https://ci.nodejs.org/job/node-test-pull-request/5282/ |
Landed in: 4f486aa Thanks for the contribution |
Requiring a file from a directory that contains an invalid package.json file should throw an error. PR-URL: #10044 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Requiring a file from a directory that contains an invalid package.json file should throw an error. PR-URL: #10044 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Requiring a file from a directory that contains an invalid package.json file should throw an error. PR-URL: #10044 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Requiring a file from a directory that contains an invalid package.json file should throw an error. PR-URL: #10044 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Requiring a file from a directory that contains an invalid package.json file should throw an error. PR-URL: #10044 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Requiring a file from a directory that contains an invalid package.json file should throw an error. PR-URL: #10044 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
OpenSSL 1.1.1d does not ship with getrandom syscall being predefined on all architectures. So when NodeJS is run with glibc prior to 2.25, where getentropy is unavailable, and the getrandom syscall is unknown, it will fail. PPC64LE or s390 are affected by lack of this definition. Original commit message. commit 4dcb150ea30f9bbfa7946e6b39c30a86aca5ed02 Author: Kurt Roeckx <kurt@roeckx.be> Date: Sat Sep 28 14:59:32 2019 +0200 Add defines for __NR_getrandom for all Linux architectures Fixes: nodejs#10015 Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> GH: nodejs#10044 Fixes: nodejs#31671
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
Requiring a file from a directory that contains an invalid package.json
file should throw an error.