jquery/test/runner/jsdom/createWindow.js
Timmy Willison 284b082eb8
Tests: share queue/browser handling for all worker types
- one queue to rule them all: browserstack, selenium, and jsdom
- retries and hard retries are now supported in selenium
- selenium tests now re-use browsers in the same way as browserstack

Close gh-5460
2024-04-01 10:23:36 -04:00

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;
}