From 65fc216154fbff9f553ef56a68ae458f9b48154b Mon Sep 17 00:00:00 2001 From: Klaus Hartl Date: Wed, 21 Jun 2023 14:32:58 +0200 Subject: [PATCH] Eliminate "QUnit is not defined" errors These appeared for tests involving an iframe, didn't affect the test result itself, but produced unhelpful noise when running tests. See https://github.com/gruntjs/grunt-contrib-qunit/issues/202 Closes #826 --- Gruntfile.js | 6 ++++++ test/fix-qunit-reference.js | 1 + 2 files changed, 7 insertions(+) create mode 100644 test/fix-qunit-reference.js diff --git a/Gruntfile.js b/Gruntfile.js index 4fee38c2..781c3bf9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -21,6 +21,12 @@ function encodingMiddleware (request, response, next) { const config = { qunit: { + options: { + inject: [ + 'test/fix-qunit-reference.js', // => https://github.com/gruntjs/grunt-contrib-qunit/issues/202 + 'node_modules/grunt-contrib-qunit/chrome/bridge.js' + ] + }, all: { options: { urls: [ diff --git a/test/fix-qunit-reference.js b/test/fix-qunit-reference.js new file mode 100644 index 00000000..5ef104d3 --- /dev/null +++ b/test/fix-qunit-reference.js @@ -0,0 +1 @@ +if (window.parent) window.QUnit = window.parent.window.QUnit