aboutsummaryrefslogtreecommitdiffstats
path: root/test/runner/jsdom
diff options
context:
space:
mode:
authorTimmy Willison <timmywil@users.noreply.github.com>2024-04-01 10:23:36 -0400
committerGitHub <noreply@github.com>2024-04-01 10:23:36 -0400
commit284b082eb86602705519d6ca754c40f6d2f8fcc0 (patch)
treebe30f1d0656bdab531f9eeefacc2a99e7d6d70bf /test/runner/jsdom
parent691c0aeeded5dea1ca2a0c5474c7adfdb1dadffe (diff)
downloadjquery-284b082eb86602705519d6ca754c40f6d2f8fcc0.tar.gz
jquery-284b082eb86602705519d6ca754c40f6d2f8fcc0.zip
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
Diffstat (limited to 'test/runner/jsdom')
-rw-r--r--test/runner/jsdom/createWindow.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/runner/jsdom/createWindow.js b/test/runner/jsdom/createWindow.js
new file mode 100644
index 000000000..de6c63ffa
--- /dev/null
+++ b/test/runner/jsdom/createWindow.js
@@ -0,0 +1,21 @@
+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;
+}