blob: c4e3d6f5f9c2767e7e9871d9333e509f1b14916d (
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(Error);
expect(e.name).toBe("Error");
expect(e.message).toBe("Call stack size limit exceeded");
}
expect(() => {
JSON.stringify({}, () => ({ foo: "bar" }));
}).toThrowWithMessage(Error, "Call stack size limit exceeded");
expect(() => {
new Proxy({}, { get: (_, __, p) => p.foo }).foo;
}).toThrowWithMessage(Error, "Call stack size limit exceeded");
});
|