Previously, this code ran into the problem that the timeout for dozens of
API requests was hit and the test failed.
The timeout now starts within each individual step.
Bug: T125484
Change-Id: Ia7874ccafadf93986278a241d9d308be0bc99493
/**
* @param {Function[]} tasks List of functions that perform tasks
* that may be asynchronous. Invoke the callback parameter when done.
/**
* @param {Function[]} tasks List of functions that perform tasks
* that may be asynchronous. Invoke the callback parameter when done.
- * @param {Function} complete Called when all tasks are done, or when the sequence is aborted.
- function process( tasks, complete ) {
+ function process( tasks ) {
/*jshint latedef:false */
function abort() {
tasks.splice( 0, tasks.length );
/*jshint latedef:false */
function abort() {
tasks.splice( 0, tasks.length );
} else {
// Remove tasks list to indicate the process is final.
tasks = null;
} else {
// Remove tasks list to indicate the process is final.
tasks = null;
mw.messages.set( mw.libs.phpParserData.messages );
var tasks = $.map( mw.libs.phpParserData.tests, function ( test ) {
return function ( next, abort ) {
mw.messages.set( mw.libs.phpParserData.messages );
var tasks = $.map( mw.libs.phpParserData.tests, function ( test ) {
return function ( next, abort ) {
+ var done = assert.async();
getMwLanguage( test.lang )
.then( function ( langClass ) {
mw.config.set( 'wgUserLanguage', test.lang );
getMwLanguage( test.lang )
.then( function ( langClass ) {
mw.config.set( 'wgUserLanguage', test.lang );
}, function () {
assert.ok( false, 'Language "' + test.lang + '" failed to load.' );
} )
}, function () {
assert.ok( false, 'Language "' + test.lang + '" failed to load.' );
} )
.then( next, abort );
};
} );
.then( next, abort );
};
} );
- QUnit.stop();
- process( tasks, QUnit.start );
} );
QUnit.test( 'Links', 14, function ( assert ) {
} );
QUnit.test( 'Links', 14, function ( assert ) {
mw.messages.set( 'formatnum-msg-int', '{{formatnum:$1|R}}' );
var queue = $.map( formatnumTests, function ( test ) {
return function ( next, abort ) {
mw.messages.set( 'formatnum-msg-int', '{{formatnum:$1|R}}' );
var queue = $.map( formatnumTests, function ( test ) {
return function ( next, abort ) {
+ var done = assert.async();
getMwLanguage( test.lang )
.then( function ( langClass ) {
mw.config.set( 'wgUserLanguage', test.lang );
getMwLanguage( test.lang )
.then( function ( langClass ) {
mw.config.set( 'wgUserLanguage', test.lang );
}, function () {
assert.ok( false, 'Language "' + test.lang + '" failed to load' );
} )
}, function () {
assert.ok( false, 'Language "' + test.lang + '" failed to load' );
} )
.then( next, abort );
};
} );
.then( next, abort );
};
} );
- QUnit.stop();
- process( queue, QUnit.start );