parallel_tests 2.26.2 → 2.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9525dd714302ff3696056c126326b6f2f580f9ba6437f69c9b6b73021f780436
4
- data.tar.gz: 647cfbaf58b77f029fb2d0faf85538913e357cb98dbfb00eb07855cd4f6b3f26
3
+ metadata.gz: 01b6de7a12281670eb21d414bac185726fab522f49a17260cfc6e18e0b120c2b
4
+ data.tar.gz: 8eafb297389404e96a76cf62ef574b785879d530d0b8d771b8d983e8c5f808cf
5
5
  SHA512:
6
- metadata.gz: 89d39061c091ae7e43fabc1a61edebe35a03bd5619fc211d7fa4022b6f785b19175aeca336dd996e36b7f7400eba0ac28eb3f0c325aa8ad873dc4f3660f050b5
7
- data.tar.gz: d9c3c6e37d52ac993849fedb08f8dde1477e0de4f95d9e429a16f59735d098bb01d56772ab8f7895a368f1cd78a111c965463686e766c6dd0cf699cc17469c04
6
+ metadata.gz: c7e98692653ffb21768c0972e54f804d82da4f8ef4c28e057452162531a9267dbef169a4506d30ccf44ac87a7f97adf067a0c499a3449335556c05b08f442968
7
+ data.tar.gz: aa6d92c2345e5ceebc01605717364670045124459550f90dfb0f9225bd20925f8955641e7e43888e3bd4dee57733e71fe68b0868a23574f458aebfc88e58e557
data/Readme.md CHANGED
@@ -371,6 +371,8 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
371
371
  - [Andrei Botalov](https://github.com/abotalov)
372
372
  - [Zachary Attas](https://github.com/snackattas)
373
373
  - [David Rodríguez](https://github.com/deivid-rodriguez)
374
+ - [Justin Doody](https://github.com/justindoody)
375
+ - [Sandeep Singh](https://github.com/sandeepnagra)
374
376
 
375
377
  [Michael Grosser](http://grosser.it)<br/>
376
378
  michael@grosser.it<br/>
@@ -1,3 +1,4 @@
1
+ require 'cucumber/tag_expressions/parser'
1
2
  require 'cucumber/core/gherkin/tag_expression'
2
3
 
3
4
  module ParallelTests
@@ -12,7 +13,7 @@ module ParallelTests
12
13
  end
13
14
 
14
15
  def visit_feature_element(uri, feature_element, feature_tags, line_numbers: [])
15
- scenario_tags = feature_element[:tags].map {|tag| ::Cucumber::Core::Ast::Tag.new(tag[:location], tag[:name])}
16
+ scenario_tags = feature_element[:tags].map { |tag| tag[:name] }
16
17
  scenario_tags = feature_tags + scenario_tags
17
18
  if feature_element[:examples].nil? # :Scenario
18
19
  test_line = feature_element[:location][:line]
@@ -25,7 +26,7 @@ module ParallelTests
25
26
  @scenarios << [uri, feature_element[:location][:line]].join(":")
26
27
  else # :ScenarioOutline
27
28
  feature_element[:examples].each do |example|
28
- example_tags = example[:tags].map {|tag| ::Cucumber::Core::Ast::Tag.new(tag[:location], tag[:name])}
29
+ example_tags = example[:tags].map { |tag| tag[:name] }
29
30
  example_tags = scenario_tags + example_tags
30
31
  next unless @tag_expression.evaluate(example_tags)
31
32
  rows = example[:tableBody].select { |body| body[:type] == :TableRow }
@@ -1,31 +1,38 @@
1
+ require 'cucumber/tag_expressions/parser'
1
2
  require 'cucumber/core/gherkin/tag_expression'
2
3
  require 'cucumber/runtime'
3
4
  require 'cucumber'
4
5
  require 'parallel_tests/cucumber/scenario_line_logger'
5
6
  require 'parallel_tests/gherkin/listener'
6
7
  require 'gherkin/errors'
8
+ require 'shellwords'
7
9
 
8
10
  module ParallelTests
9
11
  module Cucumber
10
12
  class Scenarios
11
13
  class << self
12
14
  def all(files, options={})
15
+ # Parse tag expression from given test options and ignore tag pattern. Refer here to understand how new tag expression syntax works - https://github.com/cucumber/cucumber/tree/master/tag-expressions
13
16
  tags = []
14
- tags.concat options[:ignore_tag_pattern].to_s.split(/\s*,\s*/).map {|tag| "~#{tag}" }
15
- tags.concat options[:test_options].to_s.scan(/(?:-t|--tags) (~?@[\w,~@]+)/).flatten
17
+ words = options[:test_options].to_s.shellsplit
18
+ words.each_with_index { |w,i| tags << words[i+1] if ["-t", "--tags"].include?(w) }
19
+ if ignore = options[:ignore_tag_pattern]
20
+ tags << "not (#{ignore})"
21
+ end
22
+ tags_exp = tags.compact.join(" and ")
16
23
 
17
- split_into_scenarios files, tags.uniq
24
+ split_into_scenarios files, tags_exp
18
25
  end
19
26
 
20
27
  private
21
28
 
22
- def split_into_scenarios(files, tags=[])
23
-
24
- # Create the tag expression instance from gherkin, this is needed to know if the scenario matches with the tags invoked by the request
25
- tag_expression = ::Cucumber::Core::Gherkin::TagExpression.new(tags)
29
+ def split_into_scenarios(files, tags='')
26
30
 
31
+ # Create the tag expression instance from cucumber tag expressions parser, this is needed to know if the scenario matches with the tags invoked by the request
27
32
  # Create the ScenarioLineLogger which will filter the scenario we want
28
- scenario_line_logger = ParallelTests::Cucumber::Formatters::ScenarioLineLogger.new(tag_expression)
33
+ args = []
34
+ args << ::Cucumber::TagExpressions::Parser.new.parse(tags) unless tags.empty?
35
+ scenario_line_logger = ParallelTests::Cucumber::Formatters::ScenarioLineLogger.new(*args)
29
36
 
30
37
  # here we loop on the files map, each file will contain one or more scenario
31
38
  features ||= files.map do |path|
@@ -45,7 +52,7 @@ module ParallelTests
45
52
  begin
46
53
  # We make an attempt to parse the gherkin document, this could be failed if the document is not well formatted
47
54
  result = parser.parse(scanner)
48
- feature_tags = result[:feature][:tags].map { |tag| ::Cucumber::Core::Ast::Tag.new(tag[:location], tag[:name]) }
55
+ feature_tags = result[:feature][:tags].map { |tag| tag[:name] }
49
56
 
50
57
  # We loop on each children of the feature
51
58
  result[:feature][:children].each do |feature_element|
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '2.26.2'
2
+ VERSION = Version = '2.27.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.26.2
4
+ version: 2.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2018-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel