-
-
Notifications
You must be signed in to change notification settings - Fork 173
test: migrated graceful-shutdown.test.js from tap to node:test #825
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
base: main
Are you sure you want to change the base?
test: migrated graceful-shutdown.test.js from tap to node:test #825
Conversation
2a31fae
to
2954630
Compare
2954630
to
61c443c
Compare
test/graceful-shutdown.test.js
Outdated
const sigintHandler = () => { | ||
try { | ||
sinon.assert.called(spy) | ||
t.pass('fastify.close() was called on SIGINT') |
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 we should check this with a t.plan
.
Especially because t.pass
is not part of the node test runner, so this test should fail
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 Plan hasn't been inserted.
The assertion could be unchecked and the test would still pass.
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 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.
Instead of being async, you should end the test once the assertion has been checked
Contrary to tap, the test runner doesn't wait for the plan to complete
Co-authored-by: Manuel Spigolon <[email protected]> Signed-off-by: Antonio Tripodi <[email protected]>
Most likely, the problem is related to how the SIGINT signal is handled in the CI environment. For now, I have set it to skip the test with Windows, Linux, and macOS. I don't know if this is the right thing to do 😄, see commit here: 0e5cef3 |
Co-authored-by: Manuel Spigolon <[email protected]> Signed-off-by: Antonio Tripodi <[email protected]>
Co-authored-by: Manuel Spigolon <[email protected]> Signed-off-by: Antonio Tripodi <[email protected]>
Co-authored-by: Manuel Spigolon <[email protected]> Signed-off-by: Antonio Tripodi <[email protected]>
process.exit() | ||
}) | ||
|
||
test('should call fastify.close() on SIGINT', { skip: isWindows || isMacOS || isLinux }, (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.
if this will not run on windows, macos and linux..it means essentially that will never run
We should keep the check as it was (so just skip windows) and check what's happening
Checklist
npm run test
andnpm run benchmark
and the Code of conduct
Proposal:
graceful-shutdown.test.js
fromtap
tonode:test
🔥