parallel_tests 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ed42ec93713ac6a2e11731be0eddc4039dbda87
4
- data.tar.gz: f763b44b7989ebcf6178a7b07e14a10c7f4fd45d
3
+ metadata.gz: 6ce6ccd3931181ca1ec88b0a66c89423be032e64
4
+ data.tar.gz: 4b2de8a2931ed83c775fdaa60d486407a4e518ad
5
5
  SHA512:
6
- metadata.gz: d5fbb7f7ba5db2052cffdb5479c55b317b40089b726de24931b3c73a94b376cbcdfb80f743d5f649ed7b860b22956e6d59d7cc330f34fbd9eb4b81ba5b726312
7
- data.tar.gz: b54a91287e99b49546bb5fa0bfdaef98aa2842259f9829fd39b7313e93806f54cbcec1c7972b556edb1b4a60f44026b3272cdac22b1831fa6d85d58a789473d6
6
+ metadata.gz: 524d9dbcb29345dfbfea0ba8e423c9766c2db6e87cbc1cfecbfecd65671ec971a5c390a06d7dbd40e45b37f2d920aeba1ddf178054c755bfd8e8a0300943d5d9
7
+ data.tar.gz: 09ee314cdf3e62a05b846e77f1f92817af1571e1f1d735b63788146719bf2d0bdfdce9404c5aad9563ff4066e61fd47079a30a30579aaa8d8a57ca13d1aa4dbd
data/Readme.md CHANGED
@@ -11,10 +11,10 @@ Setup for Rails
11
11
  [RailsCasts episode #413 Fast Tests](http://railscasts.com/episodes/413-fast-tests)
12
12
 
13
13
  ### Install
14
+ `Gemfile`:
14
15
 
15
16
  ```ruby
16
- # Gemfile
17
- gem "parallel_tests", group: :development
17
+ gem 'parallel_tests', group: [:development, :test]
18
18
  ```
19
19
 
20
20
  ### Add to `config/database.yml`
@@ -80,7 +80,7 @@ Running things once
80
80
  ===================
81
81
 
82
82
  ```Ruby
83
- # effected by race-condition: first process may boot slower the second
83
+ # affected by race-condition: first process may boot slower the second
84
84
  # either sleep a bit or use a lock for example File.lock
85
85
  ParallelTests.first_process? ? do_something : sleep(1)
86
86
 
@@ -185,7 +185,7 @@ Options are:
185
185
  <!-- copy output from bundle exec ./bin/parallel_test -h -->
186
186
 
187
187
  -n [PROCESSES] How many processes to use, default: available CPUs
188
- -p, --pattern [PATTERN] run tests matching this pattern
188
+ -p, --pattern [PATTERN] run tests matching this regex pattern
189
189
  --group-by [TYPE] group tests by:
190
190
  found - order of finding files
191
191
  steps - number of cucumber/spinach steps
@@ -139,7 +139,7 @@ module ParallelTests
139
139
  Options are:
140
140
  BANNER
141
141
  opts.on("-n [PROCESSES]", Integer, "How many processes to use, default: available CPUs") { |n| options[:count] = n }
142
- opts.on("-p", "--pattern [PATTERN]", "run tests matching this pattern") { |pattern| options[:pattern] = /#{pattern}/ }
142
+ opts.on("-p", "--pattern [PATTERN]", "run tests matching this regex pattern") { |pattern| options[:pattern] = /#{pattern}/ }
143
143
  opts.on("--group-by [TYPE]", <<-TEXT.gsub(/^ /, '')
144
144
  group tests by:
145
145
  found - order of finding files
@@ -1,4 +1,4 @@
1
- require 'gherkin/tag_expression'
1
+ require 'cucumber/core/gherkin/tag_expression'
2
2
 
3
3
  module ParallelTests
4
4
  module Cucumber
@@ -1,4 +1,4 @@
1
- require 'gherkin/tag_expression'
1
+ require 'cucumber/core/gherkin/tag_expression'
2
2
  require 'cucumber/runtime'
3
3
  require 'cucumber'
4
4
  require 'parallel_tests/cucumber/scenario_line_logger'
@@ -1,4 +1,4 @@
1
- require 'gherkin'
1
+ require 'gherkin/parser'
2
2
 
3
3
  module ParallelTests
4
4
  module Gherkin
@@ -42,14 +42,22 @@ module ParallelTests
42
42
  end
43
43
 
44
44
  def build_features_with_steps(tests, options)
45
- require 'parallel_tests/gherkin/listener'
46
- listener = ParallelTests::Gherkin::Listener.new
47
- listener.ignore_tag_pattern = Regexp.compile(options[:ignore_tag_pattern]) if options[:ignore_tag_pattern]
48
- parser = ::Gherkin::Parser::Parser.new(listener, true, 'root')
49
- tests.each do |file|
50
- parser.parse(File.read(file), file, 0)
45
+ require 'gherkin/parser'
46
+ ignore_tag_pattern = options[:ignore_tag_pattern].nil? ? nil : Regexp.compile(options[:ignore_tag_pattern])
47
+ parser = ::Gherkin::Parser.new
48
+ # format of hash will be FILENAME => NUM_STEPS
49
+ steps_per_file = tests.each_with_object({}) do |file,steps|
50
+ feature = parser.parse(File.read(file)).fetch(:feature)
51
+
52
+ # skip feature if it matches tag regex
53
+ next if feature[:tags].grep(ignore_tag_pattern).any?
54
+
55
+ # count the number of steps in the file
56
+ # will only include a feature if the regex does not match
57
+ all_steps = feature[:children].map{|a| a[:steps].count if a[:tags].grep(ignore_tag_pattern).empty? }.compact
58
+ steps[file] = all_steps.inject(0,:+)
51
59
  end
52
- listener.collect.sort_by { |_, value| -value }
60
+ steps_per_file.sort_by { |_, value| -value }
53
61
  end
54
62
 
55
63
  def group_by_scenarios(tests, options={})
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '2.5.0'
2
+ VERSION = Version = '2.6.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.5.0
4
+ version: 2.6.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: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel