The built-in vm module of Node.js is what underpins JSDOM's script-running magic.
Some advanced use cases, like pre-compiling a script and then running it multiple
times, benefit from using the vm module directly with a jsdom-created Window.
Throws
If the JSDOM instance was created without runScripts set, or if you are using JSDOM in a web browser.
The built-in
vmmodule of Node.js is what underpins JSDOM's script-running magic. Some advanced use cases, like pre-compiling a script and then running it multiple times, benefit from using thevmmodule directly with a jsdom-createdWindow.Throws
If the
JSDOMinstance was created withoutrunScriptsset, or if you are using JSDOM in a web browser.