Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mayankchd opened this issue Dec 4, 2015 · 4 comments

Comments

@mayankchd
Copy link
Contributor

  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 .

@mayankchd
Copy link
Contributor Author

I can submit a PR + tests(for checking circular reference) for this.

@vvo
Copy link
Collaborator

vvo commented Dec 8, 2015

@mayankchd I think it's a reasonable approache to use something that seems more maintained where all the bugs we need are fixed.

DO it!

@mjackson
Copy link
Owner

Released in v 1.13.1

@rstacruz
Copy link
Collaborator

Hm, maybe a bit of a regression here, I'm getting errors like these (extra line breaks mine):

Error: Expected
  { 'README.md': 'index.html', 'docs/install.md': 'install.html', 'docs/usage.md': 'usage.html' }
  to equal
  { 'README.md': 'index.html', 'docs/install.md': 'install.html', 'docs/usage.md': 'usage.html' }

Repo is here, build is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants