lib/cypress_rails/cli.rb in cypress_rails-0.5.0 vs lib/cypress_rails/cli.rb in cypress_rails-0.6.0

- old
+ new

@@ -3,11 +3,13 @@ require "thor" require "cypress_rails/runner" require "cypress_rails/server" module CypressRails - Config = Struct.new(:command, :cypress_bin_path, :host, :log_path, :tests_path) + Config = Struct.new( + :command, :cypress_bin_path, :host, :log_path, :tests_path, :healthcheck_url + ) class CLI < Thor class_option :command, type: :string, desc: "command to start the server", @@ -31,10 +33,16 @@ class_option :tests_path, type: :string, desc: "path to Cypress tests", default: "./spec", aliases: %w(-t) + class_option :healthcheck_url, + type: :string, + desc: <<~DESC, + url to ping the server before running tests (you don't need the port, it will be injected) + DESC + aliases: %w(-u) desc "test", "Run all tests in headless mode" def test server.start do |host, port| exit Runner.new( @@ -53,15 +61,17 @@ end private def server - @server ||= Server.new(config.host, config.command, config.log_path) + @server ||= Server.new(config.host, config.command, config.healthcheck_url, config.log_path) end def config @config ||= Config.new( - *options.values_at(:command, :cypress_bin_path, :host, :log_path, :tests_path) + *options.values_at( + :command, :cypress_bin_path, :host, :log_path, :tests_path, :healthcheck_url + ) ) end end end