assert.js, notDeepStrictEqual (line 547) contains confusing language #4714
-
The notDeepStrictEqual() function contained within assert.js (https://github.com/nodejs/node/blob/v19.9.0/lib/assert.js#L547), has a test that checks for equality between an actual and expected value using the isDeepStrictEqual() function on line 547. However, the error returned references 'notDeepStrictEqual' as the operator and stackStartFn. The language of the innerFail seems misleading because the failure states 'notDeepStrictEqual' but in the case of failure the actual and expected values are indeed equal. The logic of the code makes sense -> when testing for inequality, the numbers should not be equal. But the messaging appears to say the opposite -> actual and expected values match, but the innerFail error could imply that the values should not match, literally 'notDeepStrictEqual'. |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 3 replies
-
Rephrasing this as a question for discussion, does the solid logic behind the code invalidate any potential concerns about messaging? |
Beta Was this translation helpful? Give feedback.
Answering your question with another question: Is there an actual situation where the message provided to the user is in fact misleading? This sure seems to make a lot of sense to me: