Skip to content

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

DEV: Don't use `Dir.chdir()` (#16535)

Jarek Radosz1209d51a7f8f
diff --git a/lib/tasks/qunit.rake b/lib/tasks/qunit.rake
index d54f9ed8a8f..be5f6654b53 100644
--- a/lib/tasks/qunit.rake
+++ b/lib/tasks/qunit.rake
@@ -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