blob: ad147abc660d44f7fcc96e3e284a1eb41ef98713 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
test("infinite recursion", () => {
function infiniteRecursion() {
infiniteRecursion();
}
try {
infiniteRecursion();
} catch (e) {
expect(e).toBeInstanceOf(InternalError);
expect(e.name).toBe("InternalError");
expect(e.message).toBe("Call stack size limit exceeded");
}
expect(() => {
JSON.stringify({}, () => ({ foo: "bar" }));
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
expect(() => {
new Proxy({}, { get: (_, __, p) => p.foo }).foo;
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
});
|