diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-12-16 19:33:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-16 19:33:49 +0100 |
commit | 341c6d1b5abe4829f59fbc32e93f6a6a1afb900f (patch) | |
tree | 969b366a31121f0ac16893164dd4b9e738e89240 /test/data/testinit-jsdom.js | |
parent | f37c2e51f36c8f8bab3879064a90e86a685feafc (diff) | |
download | jquery-341c6d1b5abe4829f59fbc32e93f6a6a1afb900f.tar.gz jquery-341c6d1b5abe4829f59fbc32e93f6a6a1afb900f.zip |
Build: Make Karma work in ES modules mode
Also, run such a suite in CI to make sure modules are working as expected
when used directly.
Closes gh-4550
Diffstat (limited to 'test/data/testinit-jsdom.js')
-rw-r--r-- | test/data/testinit-jsdom.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/data/testinit-jsdom.js b/test/data/testinit-jsdom.js index 37e57d8c4..bdb3c178e 100644 --- a/test/data/testinit-jsdom.js +++ b/test/data/testinit-jsdom.js @@ -41,3 +41,17 @@ function url( value ) { return baseURL + value + ( /\?/.test( value ) ? "&" : "?" ) + new Date().getTime() + "" + parseInt( Math.random() * 100000, 10 ); } + +// The file-loading part of testinit.js#loadTests is handled by +// jsdom Karma config; here we just need to trigger relevant APIs. +this.loadTests = function() { + + // Delay the initialization until after all the files are loaded + // as in the JSDOM case we load them via Karma (see Gruntfile.js) + // instead of directly in testinit.js. + window.addEventListener( "load", function() { + window.__karma__.start(); + jQuery.noConflict(); + QUnit.start(); + } ); +}; |