2020-11-08 12:54:52 +00:00
|
|
|
test("infinite recursion", () => {
|
|
|
|
function infiniteRecursion() {
|
|
|
|
infiniteRecursion();
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
infiniteRecursion();
|
|
|
|
} catch (e) {
|
2021-11-26 23:39:57 +00:00
|
|
|
expect(e).toBeInstanceOf(InternalError);
|
|
|
|
expect(e.name).toBe("InternalError");
|
2020-11-08 12:54:52 +00:00
|
|
|
expect(e.message).toBe("Call stack size limit exceeded");
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(() => {
|
|
|
|
JSON.stringify({}, () => ({ foo: "bar" }));
|
2021-11-26 23:39:57 +00:00
|
|
|
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
|
2020-11-08 12:54:52 +00:00
|
|
|
|
|
|
|
expect(() => {
|
|
|
|
new Proxy({}, { get: (_, __, p) => p.foo }).foo;
|
2021-11-26 23:39:57 +00:00
|
|
|
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
|
2020-11-08 12:54:52 +00:00
|
|
|
});
|