discourse/app/helpers/qunit_helper.rb
David Taylor 4cceb55621
Revert "PERF: Update ember-auto-import (#15814)" (#15854)
This reverts commit f4c6a61855 and a8325c9016

This update of ember-auto-import and webpack causes significantly higher memory use during rebuilds. This made ember-cli totally unusable on 1GB RAM / 2GB swap environments. We don't have a specific need for this upgrade right now, so reverting for now.
2022-02-07 22:41:07 +00:00

48 lines
1.3 KiB
Ruby

# frozen_string_literal: true
module QunitHelper
def vendor_theme_tests
return preload_script("vendor-theme-tests") if @legacy_ember
preload_script("vendor")
end
def support_bundles
result = []
if Rails.env.production? || @legacy_ember
result << preload_script("discourse/tests/test-support-rails")
result << preload_script("discourse/tests/test-helpers-rails")
else
result << preload_script("test-support")
result << preload_script("test-helpers")
end
result.join("\n").html_safe
end
def boot_bundles
result = []
if @legacy_ember
result << preload_script("discourse/tests/test_starter")
elsif @is_proxied
result << preload_script("scripts/discourse-test-listen-boot")
result << preload_script("scripts/discourse-boot")
else
result << preload_script("discourse-test-listen-boot")
result << preload_script("discourse-boot")
end
result.join("\n").html_safe
end
def theme_tests
theme = Theme.find_by(id: request.env[:resolved_theme_id])
return "" if theme.blank?
_, digest = theme.baked_js_tests_with_digest
src = "#{GlobalSetting.cdn_url}" \
"#{Discourse.base_path}" \
"/theme-javascripts/tests/#{theme.id}-#{digest}.js" \
"?__ws=#{Discourse.current_hostname}"
"<script src='#{src}'></script>".html_safe
end
end