File tree Expand file tree Collapse file tree 3 files changed +17
-13
lines changed
Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ def try_setpgrp
7676 def workers
7777 options [ :workers ]
7878 end
79+
80+ def worker_spawn_count ( jobs )
81+ [ workers , jobs . length ] . min
82+ end
7983 end
8084end
8185
Original file line number Diff line number Diff line change @@ -16,24 +16,22 @@ class CLI
1616 'parallelizes cucumber with custom arguments'
1717 )
1818 def cucumber ( *args )
19- config = Cucumber . configure args
19+ jobs = load_jobs ( args )
2020
21- ensure_jobs ( config )
21+ formatter = Flatware :: Cucumber :: Formatters :: Console . new ( $stdout , $stderr )
2222
2323 Flatware . verbose = options [ :log ]
24- sink = options [ 'sink-endpoint' ]
25- Worker . spawn ( count : workers , runner : Cucumber , sink : sink )
26- start_sink (
27- jobs : config . jobs ,
28- workers : workers ,
29- formatter : Flatware ::Cucumber ::Formatters ::Console . new ( $stdout, $stderr)
30- )
24+
25+ spawn_count = worker_spawn_count ( jobs )
26+ Worker . spawn ( count : spawn_count , runner : Cucumber , sink : options [ 'sink-endpoint' ] )
27+ start_sink ( jobs : jobs , workers : spawn_count , formatter : formatter )
3128 end
3229
3330 private
3431
35- def ensure_jobs ( config )
36- return if config . jobs . any?
32+ def load_jobs ( args )
33+ config = Cucumber . configure args
34+ return config . jobs if config . jobs . any?
3735
3836 abort (
3937 format (
Original file line number Diff line number Diff line change @@ -23,8 +23,10 @@ def rspec(*rspec_args)
2323 )
2424
2525 Flatware . verbose = options [ :log ]
26- Worker . spawn count : workers , runner : RSpec , sink : options [ 'sink-endpoint' ]
27- start_sink ( jobs : jobs , workers : workers , formatter : formatter )
26+
27+ spawn_count = worker_spawn_count ( jobs )
28+ Worker . spawn ( count : spawn_count , runner : RSpec , sink : options [ 'sink-endpoint' ] )
29+ start_sink ( jobs : jobs , workers : spawn_count , formatter : formatter )
2830 end
2931 end
3032end
You can’t perform that action at this time.
0 commit comments