From 37c42a57b0337d90a19a2620ae512b6557098c96 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 16 Mar 2021 14:34:59 -0400 Subject: [PATCH] DEV: Make `dockcontainer` and `hidepassed` the defaults (#12416) This makes running qunit tests in a browser much simpler --- app/assets/javascripts/discourse/ember-cli-build.js | 3 +++ app/assets/javascripts/discourse/tests/setup-tests.js | 7 +++++++ app/assets/javascripts/discourse/tests/test-helper.js | 11 ++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/ember-cli-build.js b/app/assets/javascripts/discourse/ember-cli-build.js index bd6fbbccb6d..1ceda42c6c4 100644 --- a/app/assets/javascripts/discourse/ember-cli-build.js +++ b/app/assets/javascripts/discourse/ember-cli-build.js @@ -30,6 +30,9 @@ module.exports = function (defaults) { let app = new EmberApp(defaults, { autoRun: false, + "ember-qunit": { + insertContentForTestBody: false, + }, }); // WARNING: We should only import scripts here if they are not in NPM. diff --git a/app/assets/javascripts/discourse/tests/setup-tests.js b/app/assets/javascripts/discourse/tests/setup-tests.js index be43cc10826..066d4ff314f 100644 --- a/app/assets/javascripts/discourse/tests/setup-tests.js +++ b/app/assets/javascripts/discourse/tests/setup-tests.js @@ -81,6 +81,13 @@ function createApplication(config, settings) { } function setupTestsCommon(application, container, config) { + QUnit.config.hidepassed = true; + + // Let's customize QUnit options a bit + QUnit.config.urlConfig = QUnit.config.urlConfig.filter( + (c) => ["dockcontainer", "nocontainer"].indexOf(c.id) === -1 + ); + application.rootElement = "#ember-testing"; application.setupForTesting(); application.injectTestHelpers(); diff --git a/app/assets/javascripts/discourse/tests/test-helper.js b/app/assets/javascripts/discourse/tests/test-helper.js index 9fc1cb90bdc..299a37c7807 100644 --- a/app/assets/javascripts/discourse/tests/test-helper.js +++ b/app/assets/javascripts/discourse/tests/test-helper.js @@ -8,6 +8,15 @@ document.addEventListener("discourse-booted", () => { let setupTests = require("discourse/tests/setup-tests").default; Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION = false; + document.write(` +
+
+ +
+
+
+ `); + setupTests(config.APP); - start(); + start({ setupTestContainer: false }); });