You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you read the CONTRIBUTING guide on posting bugs, and CODE_OF_CONDUCT?
yes I read the things
This issue exists in the latest tap version
I am using the latest tap
Description
When comparing objects with t.same you get a very helpful diff showing what did not match the expected object.
However, when the difference exists only between a prop with the value undefined and a prop that is missing, the check fails but it does not show any difference between the compared objects:
A deft developer may know that Node.js's built-in assert module has no such issues, and try using it to see if tap is broken. Unfortunately, if this is done inside of an async test in tap then tap will hijack the assert's output, and replace it with it's own broken output that does not show the undefined entries.
This leads to a really bad DX that drives one into the weeds trying to figure out what's wrong.
Reproduction
Run t.same against an object with a property with the value undefined and an object with the same property missing.
importtfrom"tap"t.same({},{a: undefined})
The same issue also occurs with strictSame, match, matchOnly, matchOnlyStrict, matchStrict, equal, has, and probably a few more.
// All of these print the assertion failed with no difft.same({a: null},{})t.strictSame({a: undefined},{})t.match({},{a: undefined});t.match({},{a: null});t.matchOnly({a: undefined},{})t.matchOnly({a: null},{})t.matchStrict({},{a: undefined});t.matchOnlyStrict({},{a: undefined});t.equal({a: undefined},{})t.has({},{a: undefined})t.has({},{a: null})t.hasStrict({},{a: undefined});
Is there an existing issue for this?
Have you read the
CONTRIBUTING
guide on posting bugs, andCODE_OF_CONDUCT
?This issue exists in the latest tap version
Description
When comparing objects with
t.same
you get a very helpful diff showing what did not match the expected object.However, when the difference exists only between a prop with the value undefined and a prop that is missing, the check fails but it does not show any difference between the compared objects:
A deft developer may know that Node.js's built-in assert module has no such issues, and try using it to see if tap is broken. Unfortunately, if this is done inside of an async test in tap then tap will hijack the assert's output, and replace it with it's own broken output that does not show the undefined entries.
This leads to a really bad DX that drives one into the weeds trying to figure out what's wrong.
Reproduction
Run
t.same
against an object with a property with the valueundefined
and an object with the same property missing.The same issue also occurs with strictSame, match, matchOnly, matchOnlyStrict, matchStrict, equal, has, and probably a few more.
Environment
The text was updated successfully, but these errors were encountered: