Skip to content

toEqual throws Range Error when objects with circular references are compared #50

@mayankchd

Description

@mayankchd
  it('works when object has circular reference' , function () {
      function circular() {
        this.circularRef = this
      }
      var a = new circular()
      var b = new circular()
      expect(a).toEqual(b)
   })

Throws RangeError: Maximum call stack size exceeded . 

As this package uses deep-equal to check for equality , similar issue has been filed on deep-equal 8 months ago .

I think using deeper for checking for equality would be good as it works when objects with circular references are compared.
It passed all the tests along with circular reference one .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions