Class: Ace::Test::EndToEndRunner::CLI::Commands::RunSuite

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/test/end_to_end_runner/cli/commands/run_suite.rb

Overview

CLI command for running E2E test suite across all packages

Discovers all E2E tests in the monorepo and executes them with optional parallel execution and affected package filtering.

Instance Method Summary collapse

Instance Method Details

#call(packages: nil, **options) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/ace/test/end_to_end_runner/cli/commands/run_suite.rb', line 68

def call(packages: nil, **options)
  options = coerce_types(options, parallel: :integer, timeout: :integer)

  parallel = options[:parallel]
  affected = options[:affected]
  only_failures = options[:only_failures]
  tags = parse_csv_list(options[:tags])
  exclude_tags = parse_csv_list(options[:exclude_tags])

  output = quiet?(options) ? StringIO.new : $stdout
  progress = options[:progress] && !quiet?(options)

  orchestrator = Organisms::SuiteOrchestrator.new(
    max_parallel: [parallel, 1].max,
    output: output,
    progress: progress
  )

  results = orchestrator.run(
    parallel: parallel > 0,
    affected: affected,
    only_failures: only_failures,
    packages: packages,
    cli_args: options[:cli_args],
    provider: options[:provider],
    timeout: options[:timeout],
    tags: tags,
    exclude_tags: exclude_tags,
    verify: options[:verify]
  )

  if results[:total].zero?
    if only_failures
      raise Ace::Support::Cli::Error.new(
        "No failed test scenarios found in cache"
      )
    else
      raise Ace::Support::Cli::Error.new("No tests found to run")
    end
  end

  # Exit with error if any test failed
  if results[:failed] > 0 || results[:errors] > 0
    failed_count = results[:failed] + results[:errors]
    raise Ace::Support::Cli::Error.new(
      "#{failed_count} test(s) failed or errored"
    )
  end
end