aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.intro
blob: 227aa6c3effd594386743c0d57409a28f3827b80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// The bridge in `node_modules/grunt-contrib-qunit/chrome/bridge.js` is injected
// into every iframe, even an empty one injected during QUnit tests. The bridge,
// in turn, requires QUnit to be present on the page, throwing errors otherwise.
// To workaround that, add another wrapper which detects a missing QUnit and skips
// the whole logic.

( function ( factory ) {
	if ( typeof define === 'function' && define.amd ) {
		require( [ 'qunit' ], factory );
	} else {
		factory( window.QUnit );
	}
} )( function( QUnit ) {

if ( !QUnit ) {

	// No QUnit => possibly an empty iframe injected in tests; ignore.
	return;
}