-
-
Notifications
You must be signed in to change notification settings - Fork 48
Update tests to use node:test, remove tap #235
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Yeah the windows test fails. Maybe simplest solution: change file extensions of all test files 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.
Hi, thanks a lot for the PR!
Please:
- Install
c8
- Change the
test:unit
command toc8 --100 node --test
- As @Uzlopak said, for consistency, it would be great if you could add
.test.
to the test files
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 add back the t.plan
to the tests node:test
does support test count assertions ref
@dancastillo I've removed them where they are not adding anything - they only really make sense when you have assertions in callbacks or conditional statements - everywhere I've removed them has been where I've changed to using If they should be a standard for fastify tests though then I can add them back if necessary |
@bencoder That makes sense to me! As for the standard with Fastify tests, I believe we have them in place for most of our tests but like you mention likely for callbacks or conditionals I'll defer it to @Uzlopak or @gurgunday to confirm whether it's a strict requirement or is okay |
I would reserve plans for tests of asynchronous operations. |
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
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.
Looks like there is no error
defined on await fastify.inject(...)
response ref
So this below will never fail.
t.assert.ifError(response.error)
Can we update all similar asserts to below to validate we received a truthy response
t.assert.ok(response)
…to `ok(response)` because response.error does not exist
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
Updates tests to use node:test
Remove tap
Converted tests to async/await style over callbacks and removed
t.plan(x)
statements where appropriateChecklist
npm run test
andnpm run benchmark
and the Code of conduct