mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
22 lines
485 B
JavaScript
22 lines
485 B
JavaScript
|
import jsdom from "jsdom";
|
||
|
|
||
|
const { JSDOM } = jsdom;
|
||
|
|
||
|
export default async function createWindow( { reportId, url, verbose } ) {
|
||
|
const virtualConsole = new jsdom.VirtualConsole();
|
||
|
virtualConsole.sendTo( console );
|
||
|
virtualConsole.removeAllListeners( "clear" );
|
||
|
|
||
|
const { window } = await JSDOM.fromURL( url, {
|
||
|
resources: "usable",
|
||
|
runScripts: "dangerously",
|
||
|
virtualConsole
|
||
|
} );
|
||
|
|
||
|
if ( verbose ) {
|
||
|
console.log( `JSDOM window created (${ reportId })` );
|
||
|
}
|
||
|
|
||
|
return window;
|
||
|
}
|