DEV: Don't use `Dir.chdir()` (#16535)
`system()` provides `chdir:` option for that.
This commit is contained in:
parent
dba7a1d8ed
commit
1209d51a7f
|
@ -1,7 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
desc "Runs the qunit test suite"
|
||||
|
||||
task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
||||
require "socket"
|
||||
require "chrome_installed_checker"
|
||||
|
@ -107,11 +106,9 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
|||
puts "Rails server is warmed up"
|
||||
|
||||
if ember_cli
|
||||
Dir.chdir("#{Rails.root}/app/assets/javascripts/discourse") do # rubocop:disable Discourse/NoChdir because this is not part of the app
|
||||
cmd = ["env", "UNICORN_PORT=#{unicorn_port}", "yarn", "ember", "test", "--query", query]
|
||||
cmd += ["--test-page", qunit_path.delete_prefix("/")] if qunit_path
|
||||
system(*cmd)
|
||||
end
|
||||
cmd = ["env", "UNICORN_PORT=#{unicorn_port}", "yarn", "ember", "test", "--query", query]
|
||||
cmd += ["--test-page", qunit_path.delete_prefix("/")] if qunit_path
|
||||
system(*cmd, chdir: "#{Rails.root}/app/assets/javascripts/discourse")
|
||||
else
|
||||
cmd = "node #{test_path}/run-qunit.js http://localhost:#{port}#{qunit_path}"
|
||||
cmd += "?#{query.gsub('+', '%20').gsub("&", '\\\&')}"
|
||||
|
@ -131,5 +128,4 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
|||
puts "\nTests Failed"
|
||||
exit(1)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue