MCPcopy Index your code
hub / github.com/nodejs/node / loop

Function loop

test/parallel/test-vm-timeout-escape-promise.js:15–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13const hrtime = process.hrtime.bigint;
14
15function 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
27assert.throws(() => {
28 vm.runInNewContext(

Callers

nothing calls this directly

Calls 1

hrtimeFunction · 0.85

Tested by

no test coverage detected