Skip to content

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

DEV: Update `rake qunit:test` to support filtering (#18249)

Sergei Mellow61f5c8716d2b
diff --git a/lib/tasks/qunit.rake b/lib/tasks/qunit.rake
index ebccadf102e..38a81e92bdb 100644
--- a/lib/tasks/qunit.rake
+++ b/lib/tasks/qunit.rake
@@ -1,7 +1,7 @@
# frozen_string_literal: true
desc "Runs the qunit test suite"
-task "qunit:test", [:timeout, :qunit_path] do |_, args|
+task "qunit:test", [:timeout, :qunit_path, :filter] do |_, args|
require "socket"
require "chrome_installed_checker"
@@ -65,6 +65,7 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
success = true
test_path = "#{Rails.root}/test"
qunit_path = args[:qunit_path]
+ filter = args[:filter]
options = { seed: (ENV["QUNIT_SEED"] || Random.new.seed), hidepassed: 1 }
@@ -107,6 +108,8 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
system("yarn", "ember", "build", chdir: "#{Rails.root}/app/assets/javascripts/discourse")
test_page = "#{qunit_path}?#{query}&testem=1"
cmd += ["yarn", "testem", "ci", "-f", "testem.js", "-t", test_page]
+ elsif filter
+ cmd += ["yarn", "ember", "test", "--query", query, "--filter", filter]
else
cmd += ["yarn", "ember", "exam", "--query", query]
if parallel = ENV["QUNIT_PARALLEL"]