Skip to content

Commit 5fb689d

Browse files
committed
Tests: Add dummy modules when running basic tests
Without this, other modules don't appear in the QUnit module picker. Ref 855b0c8 Closes gh-2582 (cherry picked from commit f9af896)
1 parent 81b6e46 commit 5fb689d

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

test/data/testinit.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -278,20 +278,14 @@ this.loadTests = function() {
278278

279279
// Get testSubproject from testrunner first
280280
require( [ "data/testrunner.js" ], function() {
281-
var tests = []
282-
.concat( [
283-
281+
var i = 0,
282+
tests = [
284283
// A special module with basic tests, meant for
285284
// not fully supported environments like Android 2.3,
286285
// jsdom or PhantomJS. We run it everywhere, though,
287286
// to make sure tests are not broken.
288-
//
289-
// Support: Android 2.3 only
290-
// When loading basic tests don't load any others to not
291-
// overload Android 2.3.
292-
"unit/basic.js"
293-
] )
294-
.concat( basicTests ? [] : [
287+
"unit/basic.js",
288+
295289
"unit/core.js",
296290
"unit/callbacks.js",
297291
"unit/deferred.js",
@@ -312,14 +306,23 @@ this.loadTests = function() {
312306
"unit/dimensions.js",
313307
"unit/animation.js",
314308
"unit/tween.js"
315-
] );
309+
];
316310

317311
// Ensure load order (to preserve test numbers)
318312
( function loadDep() {
319-
var dep = tests.shift();
313+
var dep = tests[ i++ ];
320314

321315
if ( dep ) {
322-
require( [ dep ], loadDep );
316+
if ( !basicTests || i === 1 ) {
317+
require( [ dep ], loadDep );
318+
319+
// Support: Android 2.3 only
320+
// When running basic tests, replace other modules with dummies to avoid overloading
321+
// impaired clients.
322+
} else {
323+
QUnit.module( dep.replace( /^.*\/|\.js$/g, "" ) );
324+
loadDep();
325+
}
323326

324327
} else {
325328
QUnit.load();

0 commit comments

Comments
 (0)