mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 17:53:55 +08:00
Previously, plugin/theme qunit test output only showed `Chrome 147.0` with no
indication of which theme/plugin a test belonged to.
This commit registers a `Testem.on("test-result")` hook that prepends
the plugin/theme name to each test name, mirroring how `ember-exam` patches testem output.
16 lines
598 B
Ruby
Vendored
16 lines
598 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module QunitHelper
|
|
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}"
|
|
"<link rel='modulepreload' href='#{src}' data-theme-id='#{theme.id}' data-theme-name='#{Rack::Utils.escape_html(theme.name)}' nonce='#{ThemeField::CSP_NONCE_PLACEHOLDER}' />".html_safe
|
|
end
|
|
end
|