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.ymlindex 401c6edb8da..d333e3c5bd9 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -324,7 +324,7 @@ jobs:env:CHECKOUT_TIMEOUT: 10run: |- 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/systemshell: bash- name: Check for failed system test artifactsdiff --git a/app/assets/javascripts/discourse/tests/test-boot-ember-cli.js b/app/assets/javascripts/discourse/tests/test-boot-ember-cli.jsindex 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.rakeindex 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.idelse@@ -289,6 +289,16 @@ task "themes:qunit_all_official" => :environment do |task, args|endend+ 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"].reenableRake::Task["themes:qunit"].invoke("ids", theme_ids_with_qunit_tests.join("|"))end