aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.intro20
-rw-r--r--tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.outro2
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.intro b/tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.intro
new file mode 100644
index 000000000..227aa6c3e
--- /dev/null
+++ b/tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.intro
@@ -0,0 +1,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;
+}
+
diff --git a/tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.outro b/tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.outro
new file mode 100644
index 000000000..647170adb
--- /dev/null
+++ b/tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.outro
@@ -0,0 +1,2 @@
+
+} );