question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Infinite recursion in deepEqual

See original GitHub issue

deepEqual doesn’t handle objects that have cyclical references:

import { Substitute } from "@fluffy-spoon/substitute";

interface Service {
  foo(a: any): void;
}

describe("Service", () => {
  it("overflows", async () => {
    const s = Substitute.for<Service>();

    const parent = {} as any;
    parent.child = { parent };

    s.foo(parent);
    s.foo(parent);
  });
});
RangeError: Maximum call stack size exceeded

    at deepEqual (/home/stephen/homebound/graphql-service/node_modules/@fluffy-spoon/substitute/src/Utilities.ts:76:19)
    at deepEqual (/home/stephen/homebound/graphql-service/node_modules/@fluffy-spoon/substitute/src/Utilities.ts:95:2)
    at deepEqual (/home/stephen/homebound/graphql-service/node_modules/@fluffy-spoon/substitute/src/Utilities.ts:95:2)
    at deepEqual (/home/stephen/homebound/graphql-service/node_modules/@fluffy-spoon/substitute/src/Utilities.ts:95:2)
    at deepEqual (/home/stephen/homebound/graphql-service/node_modules/@fluffy-spoon/substitute/src/Utilities.ts:95:2)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ffMathycommented, Apr 1, 2020

Haha yeah okay - feel free to begin then! ❤️

0reactions
notanengineercomcommented, Apr 1, 2020

@ffMathy if you don’t find the time, let me know. Due to the current state of the wold I have a few more hours of free time 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

deepEqual should not infinitely recurse an infinite lazy getter ...
Krinkle changed the title deepEqual goes into infinite recursion deepEqual should not infinitely recurse a getter-based lazy infinite chain ...
Read more >
Report indirect infinite recursion : IDEA-307577
deepEquals (this, ...) (inside equals implementation). It would be good to enhance infinite recursion inspection to report these cases. Activity settings.
Read more >
How do I stop endless recursion when two objects reference ...
If state.[[Stack]] contains value, throw a TypeError exception because the structure is cyclical. It keeps a stack of the parent objects being ...
Read more >
refs/tags/v0.4.0 - Google Git
... in a stack-overflow due to infinite recursion traversing cycles on a graph. ... DeepEqual, which declares two graphs to be equal so...
Read more >
InternalError: too much recursion - JavaScript - MDN Web Docs
This causes the function to call itself, again and again, making it infinitely recursive. This issue also appears if the same variable is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found