-
-
Notifications
You must be signed in to change notification settings - Fork 210
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: migrate from tap to node:test and c8 #843
base: master
Are you sure you want to change the base?
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.
Can you update t.assert.equal
to t.assert.strictEqual
and t.assert.deepEqual
to t.assert.deepStrictEqual
.gitignore
Outdated
#tap files | ||
.tap/ | ||
|
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.
Might be worth keeping this around for a bit just in case for people who ran tests
I made that update but ran into an issue with the Symbol that I also found some places where |
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.
Lets removed the !!
to do a strict assert of undefined
like this t.assert.strictEqual(!!value, undefined)
t.assert.strictEqual(value, undefined)` this will help explain behavior IMHO
test/spec/openapi/route.js
Outdated
t.ok(definedPath) | ||
t.match(definedPath.responses[200].content, { | ||
t.assert.ok(definedPath) | ||
t.assert.deepEqual(JSON.parse(JSON.stringify(definedPath.responses[200].content)), { |
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.
this works without JSON.parse(JSON.stringify(...)
test/spec/openapi/route.js
Outdated
t.ok(definedPath) | ||
t.match(definedPath.requestBody.content, { | ||
t.assert.ok(definedPath) | ||
t.assert.deepEqual(JSON.parse(JSON.stringify(definedPath.requestBody.content)), { |
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.
this works without JSON.parse(JSON.stringify(...)
@Eomm wdyt here - |
Co-authored-by: Dan Castillo <[email protected]> Signed-off-by: Robert Campbell <[email protected]>
Signed-off-by: Robert Campbell <[email protected]>
change from coerced value comparison against false to actual value comparison against undefined where necessary
…ify-swagger into convert-tap-to-node-test
A few decisions while converting tests:
t.same
andt.match
were converted tot.assert.deepEqual
.t.strictSame
was converted tot.assert.deepStrictEqual
.t.notOk
was converted tot.assert.equal
comparing the coerced value (using!!
) tofalse
. We could have donet.assert.ok(${value} === false)
but usingequal
withfalse
felt more in the spirit of checking that for things that are not ok.t.pass
was converted tot.assert.ok(true, ${originalMessage})
Checklist
npm run test
and the Code of conduct