From d4bc8e79637e92f5b72b71c051ac2971f607e9ab Mon Sep 17 00:00:00 2001 From: Andrii Rymar Date: Wed, 14 Apr 2021 13:44:35 +0300 Subject: [PATCH] Add --single-process-tag option to run specific Cucumber/Gherkin scenarios sequentially --- lib/parallel_tests/grouper.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/parallel_tests/grouper.rb b/lib/parallel_tests/grouper.rb index 47a733d0..0c016b67 100644 --- a/lib/parallel_tests/grouper.rb +++ b/lib/parallel_tests/grouper.rb @@ -11,7 +11,7 @@ def by_steps(tests, num_groups, options) def by_scenarios(tests, num_groups, options = {}) scenarios = group_by_scenarios(tests, options) - in_even_groups_by_size(scenarios, num_groups, options.slice(BY_SCENARIOS_SUPPORTED_OPTIONS)) + in_even_groups_by_size(scenarios, num_groups, options.slice(*BY_SCENARIOS_SUPPORTED_OPTIONS)) end def in_even_groups_by_size(items, num_groups, options = {}) @@ -128,14 +128,15 @@ def group_by_scenarios(tests, options = {}) end def separate_single_items(items, options) - items.partition { |item, _size| to_single_items?(item, options) } + items.partition { |item| to_single_items?(item, options) } end def to_single_items?(item, options) if options[:single_process] + item = item_with_tags?(item) || item_with_size?(item) ? item[0] : item options[:single_process].any? { |pattern| item =~ pattern } elsif options[:single_process_tag] - raise "--single-tag option can be used only with '--group-by scenarios'" unless item_with_tags?(item) + raise "--single-tag option can only be used with '--group-by scenarios'" unless item_with_tags?(item) item_tags = item[1] item_tags.any? { |tag| tag.match?(options[:single_process_tag]) } else