// Runs bundle.js inside a `vm` context holding only the globals listed below, // so the bundle sees the same bare environment the embedded V8 engine gives it. const fs = require("fs") const vm = require("vm") const code = fs.readFileSync(__dirname + "/bundle.js", "utf8") // The host globals React's bundle touches at init and during a sync render. const sandbox = { console, setTimeout, clearTimeout, queueMicrotask, MessageChannel, performance, TextEncoder, TextDecoder, } sandbox.globalThis = sandbox vm.createContext(sandbox) vm.runInContext(code, sandbox) const html = sandbox.renderApp({ name: "World" }) const expected = '