+ // @covers mw.loader#sortDependencies (with fallback shim)
+ QUnit.test( '.using() Error: Circular dependency [StringSet shim]', function ( assert ) {
+ var done = assert.async();
+
+ if ( !window.Set ) {
+ assert.expect( 0 );
+ done();
+ return;
+ }
+
+ this.nativeSet = window.Set;
+ window.Set = undefined;
+ mw.redefineFallbacksForTest();
+
+ mw.loader.register( [
+ [ 'test.shim.circle1', '0', [ 'test.shim.circle2' ] ],
+ [ 'test.shim.circle2', '0', [ 'test.shim.circle3' ] ],
+ [ 'test.shim.circle3', '0', [ 'test.shim.circle1' ] ]
+ ] );
+ mw.loader.using( 'test.shim.circle3' ).then(
+ function done() {
+ assert.ok( false, 'Unexpected resolution, expected error.' );
+ },
+ function fail( e ) {
+ assert.ok( /Circular/.test( String( e ) ), 'Detect circular dependency' );
+ }
+ )
+ .always( done );
+ } );
+