Infinite recursion in deepEqual
See original GitHub issuedeepEqual
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:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Haha yeah okay - feel free to begin then! ❤️
@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 😄