A platform for community discussion. Free, open, simple.
DEV: use REPORT_REQUESTS=1 to find all requests
Sam Saffron8a50ab45aaed
diff --git a/lib/tasks/qunit.rake b/lib/tasks/qunit.rakeindex a233c56dfda..2c4e965e1fb 100644--- a/lib/tasks/qunit.rake+++ b/lib/tasks/qunit.rake@@ -24,6 +24,8 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|abort "Yarn is not installed. Download from https://yarnpkg.com/lang/en/docs/install/"end+ report_requests = ENV['REPORT_REQUESTS'] == "1"+system("yarn install --dev")# ensure we have this port available@@ -63,10 +65,12 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|options[arg] = ENV[arg.upcase] if ENV[arg.upcase].present?end- if options.present?- cmd += "?#{options.to_query.gsub('+', '%20').gsub("&", '\\\&')}"+ if report_requests+ options['report_requests'] = '1'end+ cmd += "?#{options.to_query.gsub('+', '%20').gsub("&", '\\\&')}"+if args[:timeout].present?cmd += " #{args[:timeout]}"enddiff --git a/test/javascripts/test_helper.js b/test/javascripts/test_helper.jsindex 77598e47127..0f2fd5ec0a4 100644--- a/test/javascripts/test_helper.js+++ b/test/javascripts/test_helper.js@@ -117,7 +117,17 @@ QUnit.testStart(function(ctx) {return body;};+ if (QUnit.config.logAllRequests) {+ server.handledRequest = function(verb, path, request) {+ console.log("REQ: " + verb + " " + path);+ };+ }+server.unhandledRequest = function(verb, path) {+ if (QUnit.config.logAllRequests) {+ console.log("REQ: " + verb + " " + path + " missing");+ }+const error ="Unhandled request in test environment: " + path + " (" + verb + ")";window.console.error(error);diff --git a/test/run-qunit.js b/test/run-qunit.jsindex 57a0676b47c..905745b6b58 100644--- a/test/run-qunit.js+++ b/test/run-qunit.js@@ -112,6 +112,13 @@ async function runAllTests() {await Runtime.evaluate({expression: `(${qunit_script})()`});++ if (args[0].indexOf("report_requests=1") > -1) {+ await Runtime.evaluate({+ expression: "QUnit.config.logAllRequests = true"+ });+ }+const timeout = parseInt(args[1] || 300000, 10);var start = Date.now();