aboutsummaryrefslogtreecommitdiffstats
path: root/test/data
diff options
context:
space:
mode:
Diffstat (limited to 'test/data')
-rw-r--r--test/data/testinit-jsdom.js14
-rw-r--r--test/data/testinit.js11
2 files changed, 22 insertions, 3 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();
+ } );
+};
diff --git a/test/data/testinit.js b/test/data/testinit.js
index 4088e4671..61ffcbc8f 100644
--- a/test/data/testinit.js
+++ b/test/data/testinit.js
@@ -301,10 +301,11 @@ this.loadTests = function() {
// QUnit.config is populated from QUnit.urlParams but only at the beginning
// of the test run. We need to read both.
- var amd = QUnit.config.amd || QUnit.urlParams.amd;
+ var esmodules = QUnit.config.esmodules || QUnit.urlParams.esmodules,
+ amd = QUnit.config.amd || QUnit.urlParams.amd;
// Directly load tests that need evaluation before DOMContentLoaded.
- if ( !amd || document.readyState === "loading" ) {
+ if ( ( !esmodules && !amd ) || document.readyState === "loading" ) {
document.write( "<script src='" + parentUrl + "test/unit/ready.js'><\x2Fscript>" );
} else {
QUnit.module( "ready", function() {
@@ -360,7 +361,11 @@ this.loadTests = function() {
}
} else {
- QUnit.load();
+ if ( window.__karma__ && window.__karma__.start ) {
+ window.__karma__.start();
+ } else {
+ QUnit.load();
+ }
/**
* Run in noConflict mode