Skip to content

Commit

Permalink
Tests: Add dummy modules when running basic tests
Browse files Browse the repository at this point in the history
Without this, other modules don't appear in the QUnit module picker.

Ref 855b0c8
Closes gh-2582

(cherry picked from commit f9af896)
  • Loading branch information
gibson042 committed Oct 9, 2015
1 parent 81b6e46 commit 5fb689d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions test/data/testinit.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,20 +278,14 @@ this.loadTests = function() {

// Get testSubproject from testrunner first
require( [ "data/testrunner.js" ], function() {
var tests = []
.concat( [

var i = 0,
tests = [
// A special module with basic tests, meant for
// not fully supported environments like Android 2.3,
// jsdom or PhantomJS. We run it everywhere, though,
// to make sure tests are not broken.
//
// Support: Android 2.3 only
// When loading basic tests don't load any others to not
// overload Android 2.3.
"unit/basic.js"
] )
.concat( basicTests ? [] : [
"unit/basic.js",

"unit/core.js",
"unit/callbacks.js",
"unit/deferred.js",
Expand All @@ -312,14 +306,23 @@ this.loadTests = function() {
"unit/dimensions.js",
"unit/animation.js",
"unit/tween.js"
] );
];

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

if ( dep ) {
require( [ dep ], loadDep );
if ( !basicTests || i === 1 ) {
require( [ dep ], loadDep );

// Support: Android 2.3 only
// When running basic tests, replace other modules with dummies to avoid overloading
// impaired clients.
} else {
QUnit.module( dep.replace( /^.*\/|\.js$/g, "" ) );
loadDep();
}

} else {
QUnit.load();
Expand Down

0 comments on commit 5fb689d

Please sign in to comment.