A platform for community discussion. Free, open, simple.
FIX: makes rake qunit:test task work on macOS
Joffrey JAFFEUXcc819539b082
diff --git a/lib/tasks/qunit.rake b/lib/tasks/qunit.rakeindex c97b26d9bc7..b45b817f683 100644--- a/lib/tasks/qunit.rake+++ b/lib/tasks/qunit.rake@@ -1,15 +1,21 @@desc "Runs the qunit test suite"task "qunit:test", [:timeout, :qunit_path] => :environment do |_, args|-require "rack"require "socket"+ require 'rbconfig'++ if RbConfig::CONFIG['host_os'][/darwin|mac os/]+ google_chrome_cli = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"+ else+ google_chrome_cli = "google-chrome"+ end- unless system("command -v google-chrome >/dev/null;")+ unless system("command -v \"#{google_chrome_cli}\" >/dev/null")abort "Chrome is not installed. Download from https://www.google.com/chrome/browser/desktop/index.html"end- if Gem::Version.new(`$(command -v google-chrome) --version`.match(/[\d\.]+/)[0]) < Gem::Version.new("59")+ if Gem::Version.new(`\"#{google_chrome_cli}\" --version`.match(/[\d\.]+/)[0]) < Gem::Version.new("59")abort "Chrome 59 or higher is required to run tests in headless mode."end