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

This commit is contained in:
Sergei Mellow 2022-09-21 14:00:50 -04:00 committed by GitHub
parent e37ced96bf
commit 61f5c8716d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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"]