A platform for community discussion. Free, open, simple.
DEV: correctly detect chromium on macos (#35441)
Régis Hanolb042dbcf6795
diff --git a/lib/chrome_installed_checker.rb b/lib/chrome_installed_checker.rbindex c0b292b2b03..e40c8e53af4 100644--- a/lib/chrome_installed_checker.rb+++ b/lib/chrome_installed_checker.rb@@ -17,7 +17,8 @@ class ChromeInstalledCheckerdef self.runif RbConfig::CONFIG["host_os"][/darwin|mac os/]- binary = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"+ chrome_path = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"+ binary = chrome_path if File.exist?(chrome_path)elsif system("command -v google-chrome-stable >/dev/null;")binary = "google-chrome-stable"end@@ -38,5 +39,8 @@ class ChromeInstalledCheckerif Gem::Version.new(version_match[0]) < Gem::Version.new("59")raise ChromeVersionTooLow.new("Chrome 59 or higher is required")end++ # Return browser name for testem launcher (case-sensitive)+ binary.include?("chromium") ? "Chromium" : "Chrome"endenddiff --git a/lib/tasks/qunit.rake b/lib/tasks/qunit.rakeindex f0787444003..93471045c92 100644--- a/lib/tasks/qunit.rake+++ b/lib/tasks/qunit.rake@@ -5,11 +5,12 @@ task "qunit:test", %i[qunit_path filter] do |_, args|require "socket"require "chrome_installed_checker"- begin- ChromeInstalledChecker.run- rescue ChromeInstalledChecker::ChromeError => err- abort err.message- end+ detected_browser =+ begin+ ChromeInstalledChecker.run+ rescue ChromeInstalledChecker::ChromeError => err+ abort err.message+ endunless system("command -v pnpm >/dev/null;")abort "pnpm is not installed. See https://pnpm.io/installation"@@ -99,7 +100,10 @@ task "qunit:test", %i[qunit_path filter] do |_, args|endputs "Rails server is warmed up"- env = { "UNICORN_PORT" => unicorn_port.to_s }+ env = {+ "UNICORN_PORT" => unicorn_port.to_s,+ "TESTEM_DEFAULT_BROWSER" => ENV["TESTEM_DEFAULT_BROWSER"].presence || detected_browser,+ }cmd = []parallel = ENV["QUNIT_PARALLEL"]