tape-testing / tape

tap-producing test harness for node and browsers
MIT License
5.77k stars 307 forks source link

[bug] deepEqual breaking change v5.0.0 #508

Closed robertsLando closed 4 years ago

robertsLando commented 4 years ago

With version 5.0.0 all my deepEqual fails. The reason is: https://github.com/substack/tape/commit/d26c6a0e456b8f2d4390bf4ed275ab7070077f39#diff-dd2e881af3311f834199c7b515cff0c7R501

Here you set strict:true but that's wrong because with that test like this will fail:

expected: |-
        [ { cmd: 'publish', brokerId: 'broker-42', brokerCounter: 42, topic: 'hello', payload: <Buffer 77 6f 72 6c 64>, qos: 1, retain: false, dup: false } ]
      actual: |-
        [ { cmd: 'publish', brokerId: 'broker-42', brokerCounter: 42, topic: 'hello', payload: <Buffer 77 6f 72 6c 64>, qos: 1, retain: false, dup: false } ]
ljharb commented 4 years ago

v5.0.0 is a semver-major, breaking changes are expected.

Setting strict is not "wrong", it matches what node has done since like v4. If you want loose equality, use https://github.com/substack/tape#tdeeplooseequalactual-expected-msg; if you're curious to know why those two objects are considered different, i'd try require('is-equal/why') from https://npmjs.com/is-equal, and that will return a string describing the difference.

robertsLando commented 4 years ago

I didn't see deepLooseEqual, I always just used deepEqual and I saw everything was broken so I thought it was a mistake :) Thanks @ljharb