(request, names)
| 8 | // the framework loads); no-op on Node/Deno where the globals already exist. |
| 9 | if (typeof URL === "undefined" || typeof setTimeout === "undefined") { |
| 10 | const restore = (request, names) => { |
| 11 | let mod; |
| 12 | try { |
| 13 | mod = require(request); |
| 14 | } catch (_err) { |
| 15 | return; |
| 16 | } |
| 17 | for (const name of names) { |
| 18 | if (typeof globalThis[name] === "undefined" && mod[name] !== undefined) { |
| 19 | globalThis[name] = mod[name]; |
| 20 | } |
| 21 | } |
| 22 | }; |
| 23 | |
| 24 | restore("node:timers", [ |
| 25 | "setTimeout", |
no test coverage detected