diff --git a/lib/parallel_tests/cli.rb b/lib/parallel_tests/cli.rb index 7b7bf72e..0abb3342 100644 --- a/lib/parallel_tests/cli.rb +++ b/lib/parallel_tests/cli.rb @@ -211,6 +211,7 @@ def parse_options!(argv) files, remaining = extract_file_paths(argv) unless options[:execute] + files = extract_files_from_cucumber_profile(options) if files.empty? abort "Pass files or folders to run" unless files.any? options[:files] = files end @@ -228,6 +229,17 @@ def parse_options!(argv) options end + def extract_files_from_cucumber_profile(options) + return unless @runner.name == 'cucumber' + profile = nil + if options.key?(:test_options) + OptionParser.new do |opts| + opts.on("-p", "--profile [PROFILE]") { |option| profile = option } + end.parse!(options[:test_options].split(' ')) + end + @runner.files_from_profile(profile) if profile + end + def extract_file_paths(argv) dash_index = argv.rindex("--") file_args_at = (dash_index || -1) + 1 diff --git a/lib/parallel_tests/cucumber/runner.rb b/lib/parallel_tests/cucumber/runner.rb index a8466754..30d857bd 100644 --- a/lib/parallel_tests/cucumber/runner.rb +++ b/lib/parallel_tests/cucumber/runner.rb @@ -1,4 +1,5 @@ require "parallel_tests/gherkin/runner" +require 'cucumber' module ParallelTests module Cucumber @@ -28,6 +29,11 @@ def summarize_results(results) output.join("\n\n") end + + def files_from_profile(name) + ::Cucumber::Cli::ProfileLoader.new.args_from(name).grep(self.test_suffix) + end + def command_with_seed(cmd, seed) clean = cmd.sub(/\s--order\s+random(:\d+)?\b/, '') "#{clean} --order random:#{seed}"