DEV: Arrange theme QUnit dependencies in the right order (#12907)

DEV: Arrange theme QUnit dependencies in the right order (#12907)

diff --git a/app/assets/javascripts/discourse/tests/theme_qunit_ember_jquery.js b/app/assets/javascripts/discourse/tests/theme_qunit_ember_jquery.js
new file mode 100644
index 0000000..caccb2d
--- /dev/null
+++ b/app/assets/javascripts/discourse/tests/theme_qunit_ember_jquery.js
@@ -0,0 +1,6 @@
+// discourse-skip-module
+
+//= require env
+//= require jquery.debug
+//= require ember.debug
+//= require discourse-loader
diff --git a/app/assets/javascripts/discourse/tests/theme_qunit_helper.js b/app/assets/javascripts/discourse/tests/theme_qunit_helper.js
new file mode 100644
index 0000000..a9c60c9
--- /dev/null
+++ b/app/assets/javascripts/discourse/tests/theme_qunit_helper.js
@@ -0,0 +1,6 @@
+// discourse-skip-module
+
+//= require_tree ./helpers
+//= require_tree ./fixtures
+//= require ./setup-tests
+//= require test-shims
diff --git a/app/assets/javascripts/discourse/tests/theme_qunit_vendor.js b/app/assets/javascripts/discourse/tests/theme_qunit_vendor.js
new file mode 100644
index 0000000..3c6865b
--- /dev/null
+++ b/app/assets/javascripts/discourse/tests/theme_qunit_vendor.js
@@ -0,0 +1,15 @@
+// discourse-skip-module
+
+//= require qunit
+//= require ember-qunit
+//= require fake_xml_http_request
+//= require route-recognizer
+//= require pretender
+
+// These are not loaded in prod or development
+// But we need them for testing handlebars templates in qunit
+//= require handlebars
+//= require ember-template-compiler
+
+//= require sinon
+//= require break_string
diff --git a/app/assets/javascripts/discourse/tests/theme_test_helper.js b/app/assets/javascripts/discourse/tests/theme_test_helper.js
deleted file mode 100644
index a9c60c9..0000000
--- a/app/assets/javascripts/discourse/tests/theme_test_helper.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// discourse-skip-module
-
-//= require_tree ./helpers
-//= require_tree ./fixtures
-//= require ./setup-tests
-//= require test-shims
diff --git a/app/assets/javascripts/discourse/tests/theme_test_vendor.js b/app/assets/javascripts/discourse/tests/theme_test_vendor.js
deleted file mode 100644
index 0582ffd..0000000
--- a/app/assets/javascripts/discourse/tests/theme_test_vendor.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// discourse-skip-module
-
-//= require env
-//= require jquery.debug
-//= require ember.debug
-//= require qunit
-//= require ember-qunit
-//= require fake_xml_http_request
-//= require route-recognizer
-//= require pretender
-//= require discourse-loader
-
-// These are not loaded in prod or development
-// But we need them for testing handlebars templates in qunit
-//= require handlebars
-//= require ember-template-compiler
-
-//= require sinon
-//= require break_string
diff --git a/app/views/qunit/theme.html.erb b/app/views/qunit/theme.html.erb
index 2d93a62..ee37c2f 100644
--- a/app/views/qunit/theme.html.erb
+++ b/app/views/qunit/theme.html.erb
@@ -7,13 +7,14 @@
       <%= discourse_stylesheet_link_tag(:desktop, theme_ids: nil) %>
       <%= discourse_stylesheet_link_tag(:test_helper, theme_ids: nil) %>
       <%= preload_script "locales/en" %>
-      <%= preload_script "discourse/tests/theme_test_vendor" %>
+      <%= preload_script "discourse/tests/theme_qunit_ember_jquery" %>
       <%= preload_script "vendor" %>
+      <%= preload_script "discourse/tests/theme_qunit_vendor" %>
       <%= preload_script "pretty-text-bundle" %>
       <%= preload_script "markdown-it-bundle" %>
       <%= preload_script "application" %>
       <%= preload_script "admin" %>
-      <%= preload_script "discourse/tests/theme_test_helper" %>
+      <%= preload_script "discourse/tests/theme_qunit_helper" %>
       <%= theme_translations_lookup %>
       <%= theme_js_lookup %>
       <%= theme_lookup("head_tag") %>
diff --git a/config/application.rb b/config/application.rb
index 65e2a72..020f287 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -174,8 +174,9 @@ module Discourse
       confirm-new-email/bootstrap.js
       onpopstate-handler.js
       embed-application.js
-      discourse/tests/theme_test_helper.js
-      discourse/tests/theme_test_vendor.js
+      discourse/tests/theme_qunit_helper.js
+      discourse/tests/theme_qunit_vendor.js
+      discourse/tests/theme_qunit_ember_jquery.js
       discourse/tests/test_starter.js
     }
 
diff --git a/spec/requests/qunit_controller_spec.rb b/spec/requests/qunit_controller_spec.rb
index 179a9fb..36d91d1 100644
--- a/spec/requests/qunit_controller_spec.rb
+++ b/spec/requests/qunit_controller_spec.rb
@@ -92,8 +92,15 @@ describe QunitController do
         expect(response.body).to include("/stylesheets/color_definitions_base_")
         expect(response.body).to include("/stylesheets/desktop_")
         expect(response.body).to include("/stylesheets/test_helper_")
-        expect(response.body).to include("/assets/discourse/tests/theme_test_helper.js")
-        expect(response.body).to include("/assets/discourse/tests/theme_test_vendor.js")
+        expect(response.body).to include("/assets/locales/en.js")
+        expect(response.body).to include("/assets/discourse/tests/theme_qunit_ember_jquery.js")
+        expect(response.body).to include("/assets/vendor.js")
+        expect(response.body).to include("/assets/discourse/tests/theme_qunit_vendor.js")
+        expect(response.body).to include("/assets/pretty-text-bundle.js")
+        expect(response.body).to include("/assets/markdown-it-bundle.js")
+        expect(response.body).to include("/assets/application.js")
+        expect(response.body).to include("/assets/admin.js")
+        expect(response.body).to include("/assets/discourse/tests/theme_qunit_helper.js")
         expect(response.body).to match(/\/theme-javascripts\/\h{40}\.js/)
         expect(response.body).to include("/theme-javascripts/tests/#{theme.id}-")
         expect(response.body).to include("/assets/discourse/tests/test_starter.js")

GitHub sha: 486550c6

This commit appears in #12907 which was approved by davidtaylorhq. It was merged by OsamaSayegh.