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 00000000000..caccb2d83da --- /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_tests_vendor.js b/app/assets/javascripts/discourse/tests/theme_qunit_tests_vendor.js new file mode 100644 index 00000000000..3c6865b1e04 --- /dev/null +++ b/app/assets/javascripts/discourse/tests/theme_qunit_tests_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_qunit_vendor.js b/app/assets/javascripts/discourse/tests/theme_qunit_vendor.js index 3c6865b1e04..5776eb6784b 100644 --- a/app/assets/javascripts/discourse/tests/theme_qunit_vendor.js +++ b/app/assets/javascripts/discourse/tests/theme_qunit_vendor.js @@ -1,15 +1,37 @@ -// discourse-skip-module +// This bundle contains the same dependencies as app/assets/javascripts/vendor.js +// minus ember_jquery. +// ember_jquery doesn't work with theme tests in production because it +// contains production builds of Ember and jQuery, so we have a separate bundle +// caled theme_qunit_ember_jquery which contains a debug build for Ember and jQuery. +// We don't put theme_qunit_ember_jquery in this bundle because it would make the +// bundle too big and cause OOM exceptions during rebuilds for self-hosters on +// low-end machines. -//= require qunit -//= require ember-qunit -//= require fake_xml_http_request -//= require route-recognizer -//= require pretender +//= require logster -// 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 template_include.js -//= require sinon -//= require break_string +//= require message-bus +//= require jquery.ui.widget.js +//= require Markdown.Converter.js +//= require bootbox.js +//= require popper.js +//= require bootstrap-modal.js +//= require caret_position +//= require jquery.color.js +//= require jquery.fileupload.js +//= require jquery.iframe-transport.js +//= require jquery.tagsinput.js +//= require jquery.sortable.js +//= require lodash.js +//= require mousetrap.js +//= require mousetrap-global-bind.js +//= require rsvp.js +//= require show-html.js +//= require buffered-proxy +//= require jquery.autoellipsis-1.0.10 +//= require virtual-dom +//= require virtual-dom-amd +//= require intersection-observer +//= require discourse-shims +//= require pretty-text-bundle diff --git a/app/views/qunit/theme.html.erb b/app/views/qunit/theme.html.erb index c12f34adce8..3016de7711f 100644 --- a/app/views/qunit/theme.html.erb +++ b/app/views/qunit/theme.html.erb @@ -7,8 +7,9 @@ <%= discourse_stylesheet_link_tag(:desktop, theme_ids: nil) %> <%= discourse_stylesheet_link_tag(:test_helper, theme_ids: nil) %> <%= preload_script "locales/en" %> - <%= preload_script "vendor" %> + <%= preload_script "discourse/tests/theme_qunit_ember_jquery" %> <%= preload_script "discourse/tests/theme_qunit_vendor" %> + <%= preload_script "discourse/tests/theme_qunit_tests_vendor" %> <%= preload_script "markdown-it-bundle" %> <%= preload_script "application" %> <%- Discourse.find_plugin_js_assets(include_official: allow_plugins?, include_unofficial: allow_third_party_plugins?, request: request).each do |file| %> diff --git a/config/application.rb b/config/application.rb index f3a47a481a9..b1a4d82ed74 100644 --- a/config/application.rb +++ b/config/application.rb @@ -173,8 +173,10 @@ module Discourse confirm-new-email/bootstrap.js onpopstate-handler.js embed-application.js - discourse/tests/theme_qunit_helper.js + discourse/tests/theme_qunit_ember_jquery.js discourse/tests/theme_qunit_vendor.js + discourse/tests/theme_qunit_tests_vendor.js + discourse/tests/theme_qunit_helper.js discourse/tests/test_starter.js } diff --git a/spec/requests/qunit_controller_spec.rb b/spec/requests/qunit_controller_spec.rb index ec825e71a99..aa7773127e1 100644 --- a/spec/requests/qunit_controller_spec.rb +++ b/spec/requests/qunit_controller_spec.rb @@ -98,8 +98,9 @@ describe QunitController do expect(response.body).to include("/stylesheets/desktop_") expect(response.body).to include("/stylesheets/test_helper_") expect(response.body).to include("/assets/locales/en.js") - expect(response.body).to include("/assets/vendor.js") + expect(response.body).to include("/assets/discourse/tests/theme_qunit_ember_jquery.js") expect(response.body).to include("/assets/discourse/tests/theme_qunit_vendor.js") + expect(response.body).to include("/assets/discourse/tests/theme_qunit_tests_vendor.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")