Skip to content

A platform for community discussion. Free, open, simple.

DEV: Run qunit tests and system specs for bundled themes (#33704)

Jarek Radosz3ef64175f9d2
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 401c6edb8da..d333e3c5bd9 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -324,7 +324,7 @@ jobs:
env:
CHECKOUT_TIMEOUT: 10
run: |
- RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --profile=50 --verbose --format documentation tmp/themes/*/spec/system
+ RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --profile=50 --verbose --format documentation tmp/themes/*/spec/system themes/*/spec/system
shell: bash
- name: Check for failed system test artifacts
diff --git a/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js b/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js
index 8ae397edca8..3beb673fce2 100644
--- a/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js
+++ b/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js
@@ -60,7 +60,7 @@ document.addEventListener("discourse-init", () => {
}
const isPlugin = name.match(/\/plugins\//);
- const isTheme = name.match(/\/theme-\d+\//);
+ const isTheme = name.match(/\/theme--?\d+\//);
const isCore = !isPlugin && !isTheme;
const pluginName = name.match(/\/plugins\/([\w-]+)\//)?.[1];
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index f36e128f2a1..118b3c2cf38 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -281,7 +281,7 @@ task "themes:qunit_all_official" => :environment do |task, args|
ThemeMetadata::OFFICIAL_THEMES.each do |theme_name|
path = File.join(Rails.root, "tmp/themes/#{theme_name}")
- if Dir.glob("#{File.join(path, "test")}/**/*.{js,es6}").any?
+ if Dir.glob("#{File.join(path, "test")}/**/*.{js,gjs}").any?
theme = RemoteTheme.import_theme_from_directory(path)
theme_ids_with_qunit_tests << theme.id
else
@@ -289,6 +289,16 @@ task "themes:qunit_all_official" => :environment do |task, args|
end
end
+ Theme::CORE_THEMES.each do |(theme_name, theme_id)|
+ path = File.join(Rails.root, "themes/#{theme_name}")
+
+ if Dir.glob("#{File.join(path, "test")}/**/*.{js,gjs}").any?
+ theme_ids_with_qunit_tests << theme_id
+ else
+ puts "Skipping #{theme_name} as no QUnit tests have been detected"
+ end
+ end
+
Rake::Task["themes:qunit"].reenable
Rake::Task["themes:qunit"].invoke("ids", theme_ids_with_qunit_tests.join("|"))
end