()
| 13 | const hrtime = process.hrtime.bigint; |
| 14 | |
| 15 | function loop() { |
| 16 | const start = hrtime(); |
| 17 | while (1) { |
| 18 | const current = hrtime(); |
| 19 | const span = (current - start) / NS_PER_MS; |
| 20 | if (span >= 2000n) { |
| 21 | throw new Error( |
| 22 | `escaped timeout at ${span} milliseconds!`); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | assert.throws(() => { |
| 28 | vm.runInNewContext( |