tape-testing / tape

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

deepEqual fails to deep equal object and class #513

Closed ghost closed 4 years ago

ghost commented 4 years ago

Reason of submission: This always used to work, but suddenly broke? tape version: 5.0.0 Node.js version: 14.2.0 Fix: Use deepLooseEqual

To reproduce:

require('tape')('Has a bug', ( tape) => {
  class Person {
    constructor(name) {
      this.name = name
    }
  }

  const person = new Person('Daan')
  const obj = { name: 'Daan' }

  tape.deepEqual(person, obj)

  tape.end()
})

Result:

not ok 1 should be deeply equivalent
  ---
    operator: deepEqual
    expected: |-
      { name: 'Daan' }
    actual: |-
      { name: 'Daan' }
r0mflip commented 4 years ago

Duplicate of https://github.com/substack/tape/issues/508