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
{TypeError}
Note that this method will throw an exception 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.{TypeError} Note that this method will throw an exception if the
JSDOMinstance was created withoutrunScriptsset, or if you are using JSDOM in a web browser.