Sha256: 99c1c5b81aebb6b54dd72202257e613b50c63da9b8596a8800668cff3a585c8f
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module CypressRails class Runner def initialize(host:, port:, bin_path: "npx cypress", tests_path:, output: IO.new(1)) @host = host @port = port @bin_path = bin_path @tests_path = tests_path @output = output end def run pid = Process.spawn( { "CYPRESS_app_host" => host, "CYPRESS_app_port" => port.to_s, "CYPRESS_baseUrl" => "http://#{host}:#{port}" }, [bin_path, "run", "-P #{tests_path}"].join(" "), out: output, err: [:child, :out] ) output.close _, status = Process.wait2(pid) status.exitstatus end def open pid = Process.spawn( { "CYPRESS_app_host" => host, "CYPRESS_app_port" => port.to_s, "CYPRESS_baseUrl" => "http://#{host}:#{port}" }, [bin_path, "open", "-P #{tests_path}"].join(" "), out: output, err: [:child, :out] ) output.close Process.wait(pid) end private attr_reader :host, :port, :bin_path, :tests_path, :output end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cypress_rails-0.4.1 | lib/cypress_rails/runner.rb |
cypress_rails-0.4.0 | lib/cypress_rails/runner.rb |