Follows-up If8ff31b530dfbd882. Now that we have resolveStubbornly,
we don't need to filter out unknown modules ahead of time.
Aside from removing the needless filter condition, it also has
the benefit of causing a message to be logged to the console,
which can help discover problems. Previously these were silently
ignored.
Change-Id: I700db4931dfd0a412a8eca66c4a74b8831ab0086
// Filter out top-level modules that are unknown or failed to load before.
filtered = $.grep( modules, function ( module ) {
var state = mw.loader.getState( module );
- return state !== null && state !== 'error' && state !== 'missing';
+ return state !== 'error' && state !== 'missing';
} );
// Resolve remaining list using the known dependency tree.
// This also filters out modules with unknown dependencies. (T36853)
).always( done );
} );
- QUnit.test( '.load() - Error: Unregistered (ignored)', function ( assert ) {
- assert.expect( 0 );
- mw.loader.load( 'test.using.unreg2' );
+ QUnit.test( '.load() - Error: Unregistered', function ( assert ) {
+ var capture = [];
+ this.sandbox.stub( mw, 'track', function ( topic, data ) {
+ capture.push( {
+ topic: topic,
+ error: data.exception && data.exception.message,
+ source: data.source
+ } );
+ } );
+
+ mw.loader.load( 'test.load.unreg' );
+ assert.deepEqual(
+ [ {
+ topic: 'resourceloader.exception',
+ error: 'Unknown dependency: test.load.unreg',
+ source: 'resolve'
+ } ],
+ capture
+ );
} );
// Regression test for T36853