-
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: add check on an addon that doesn't register #13954
Conversation
test/addons/not-a-binding/test.js
Outdated
const common = require('../../common'); | ||
const assert = require('assert'); | ||
|
||
const re = new RegExp('Module did not self-register'); |
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 you use ^
and $
to make sure the entire error message is being matched.
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.
@cjihrig done.
e3fd9ca
to
1a5b353
Compare
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.
test/addons/not-a-binding/test.js
Outdated
const assert = require('assert'); | ||
|
||
const re = new RegExp('^Error: Module did not self-register\\.$'); | ||
assert.throws(() => require(`./build/${common.buildType}/binding`), re); |
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.
Out of curiosity, what is the reason for using a regexp object instead of a regexp literal?
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.
No reason, just that I used the node-module-version
test as model.
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 generally prefer the regexp literal form.
This commit calls require on a shared library that is not declared as a node module, and therefore does not register properly. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
1a5b353
to
1db7836
Compare
Agreed. Changed to literal. |
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
Looks like there are linting issues that need to be fixed. |
@jasnell I don't have read permissions, my user is ezequielgarcia. I'll run the linter and update. |
Access to the CI environment is temporarily blocked while testing a number of security fixes. |
Try now 😁 |
@jasnell according to https://ci.nodejs.org/job/node-test-linter/10386/console, there was some git errors...
or am I looking the wrong place? |
@ezequielgarcia that one looks like a transient issue, rerunning: |
Pre-land CI: https://ci.nodejs.org/job/node-test-pull-request/9432/ Assuming there are no objections from @bnoordhuis @jasnell @cjihrig @mhdawson ... ? |
No objections, still LGTM. |
|
still lgtm |
Landed in 13d6eae, thank you! |
This commit calls require on a shared library that is not declared as a node module, and therefore does not register properly. PR-URL: #13954 Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit calls require on a shared library that is not declared as a node module, and therefore does not register properly. PR-URL: #13954 Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit calls require on a shared library that is not declared as a node module, and therefore does not register properly. PR-URL: #13954 Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit calls require on a shared library that is not declared as a node module, and therefore does not register properly. PR-URL: #13954 Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit calls require on a shared library that is not declared as a node module, and therefore does not register properly. PR-URL: #13954 Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit calls require on a shared library that is not declared as a node module, and therefore does not register properly. PR-URL: #13954 Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This test
require()
s a shared library that won't register as a node module.Other tests would be possible such as loading a file that is not a shared library, or loading a path that doesn't exist. However, these two tests produce platform-dependent error messages, and so I haven't included them.
Checklist
make -j4 test
(UNIX) passesAffected core subsystem(s)
test