| 
									
										
										
										
											2020-11-08 12:54:52 +00:00
										 |  |  | test("infinite recursion", () => { | 
					
						
							|  |  |  |     function infiniteRecursion() { | 
					
						
							|  |  |  |         infiniteRecursion(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |         infiniteRecursion(); | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							| 
									
										
										
										
											2021-11-27 01:39:57 +02: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-27 01:39:57 +02: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-27 01:39:57 +02:00
										 |  |  |     }).toThrowWithMessage(InternalError, "Call stack size limit exceeded"); | 
					
						
							| 
									
										
										
										
											2025-02-03 21:41:35 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     expect(() => { | 
					
						
							|  |  |  |         function outer() { | 
					
						
							|  |  |  |             async function inner() { | 
					
						
							|  |  |  |                 await outer; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             inner(); | 
					
						
							|  |  |  |             outer(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         outer(); | 
					
						
							|  |  |  |     }).toThrowWithMessage(InternalError, "Call stack size limit exceeded"); | 
					
						
							| 
									
										
										
										
											2020-11-08 12:54:52 +00:00
										 |  |  | }); |