-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: permit test-signalwrap to work without test runner #28306
Conversation
test/async-hooks/test-signalwrap.js
Outdated
// TEST_THREAD_ID is set by tools/test.py. Adjust test results depending | ||
// on whether the test was invoked via test.py or from the shell | ||
// directly. | ||
const expectedLength = process.env.TEST_THREAD_ID ? 2 : 3; |
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 I suggest updating the comment to explain that the third signal event listener is the SIGWINCH handler that node installs when it thinks process.stdout
is a tty?
It's still kind of fragile because there might be a second SIGWINCH handler for process.stderr
, i.e., a total of 4.
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.
@bnoordhuis Would the test be more robust by checking process.stdout.isTTY
and process.stderr.isTTY
rather than process.env.TEST_THREAD_ID
?
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.
@Trott I think that’s better, yes. There is only one async hook per active signal (which should probably be considered a bug), so currently the number is 2 + (process.stdout.isTTY || process.stderr.isTTY)
, 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.
LGTM with Ben’s suggestion
37f498c
to
07c0428
Compare
OK, all fixed up! |
Landed in 2d1b512 |
test/async-hooks/test-signalwrap.js passes with the test.py test runner but fails if run directly with the `node` executable. Modify the test so it passes in both cases. PR-URL: #28306 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
test/async-hooks/test-signalwrap.js passes with the test.py test runner but fails if run directly with the `node` executable. Modify the test so it passes in both cases. PR-URL: #28306 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
test/async-hooks/test-signalwrap.js passes with the test.py test runner
but fails if run directly with the
node
executable. Modify the test soit passes in both cases.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes