rspec-parallel 2.14.8.3 → 2.14.8.4
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 +8 -8
- data/lib/rspec/parallel/configuration_options.rb +4 -0
- data/lib/rspec/parallel/option_parser.rb +30 -182
- data/lib/rspec/parallel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2E4MWM2ZmE0OGFhOTg1MDkzMzk5MjJjZWM3ZjIxYzZlMDM5M2FkMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmQxNGYwYmE4ZTJlNDk3YjZhNmY1OWM0YzYwOTYwNzJiZDhiMTAwZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjM1N2I0NjgxNWYyN2JmOTcwY2MxNmJlZTBhNjg5M2I3OGMwZDAzYmI2YTJm
|
10
|
+
ZTMzMzMzOTU1YWFhMDQ0OGI5MDk0ZTBmOTE2MTdiYWJhYjE3MWIwNjA2ZGZl
|
11
|
+
MzJmNTM5M2VjY2UwMWQwY2ZmNjUzODc4MjNmNDcxYzE1NjAyOWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmZhMGQ1NzNjN2VkM2Q0NjBhNGUzNWE5Y2JhMjQ3ZjIwM2EzYWNhNGFkNGMy
|
14
|
+
YmUyN2YwOTQ3OTJlNDdhOTU2MjZlM2Q3Y2YyMmFjNzhlOWZjODAwMjYwNjQ4
|
15
|
+
ODZhZjJlZDMxOTE1NWZmMzY4NWRjN2FmYjU0MjUwNWI2ZDhmNDM=
|
@@ -13,6 +13,10 @@ module RSpec
|
|
13
13
|
def command_line_options
|
14
14
|
@command_line_options ||= RSpec::Parallel::Parser.parse!(@args).merge :files_or_directories_to_run => @args
|
15
15
|
end
|
16
|
+
|
17
|
+
def options_from(path)
|
18
|
+
RSpec::Parallel::Parser.parse(args_from_options_file(path))
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -8,7 +8,17 @@ module RSpec
|
|
8
8
|
|
9
9
|
options = args.delete('--tty') ? {:tty => true} : {}
|
10
10
|
begin
|
11
|
-
parser(options).parse
|
11
|
+
parser(options).parse(args)
|
12
|
+
delete_next = false
|
13
|
+
args.delete_if do |arg|
|
14
|
+
if delete_next
|
15
|
+
true
|
16
|
+
elsif arg == '--parallel-test'
|
17
|
+
delete_next = true
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
parser(options, true).parse!(args)
|
12
22
|
rescue OptionParser::InvalidOption => e
|
13
23
|
abort "#{e.message}\n\nPlease use --help for a listing of valid options"
|
14
24
|
end
|
@@ -16,187 +26,25 @@ module RSpec
|
|
16
26
|
options
|
17
27
|
end
|
18
28
|
|
19
|
-
def parser(options)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
' [default] files are ordered based on the underlying file',
|
39
|
-
' system\'s order',
|
40
|
-
' [rand] randomize the order of files, groups and examples',
|
41
|
-
' [random] alias for rand',
|
42
|
-
' [random:SEED] e.g. --order random:123') do |o|
|
43
|
-
options[:order] = o
|
44
|
-
end
|
45
|
-
|
46
|
-
parser.on('--seed SEED', Integer, 'Equivalent of --order rand:SEED.') do |seed|
|
47
|
-
options[:order] = "rand:#{seed}"
|
48
|
-
end
|
49
|
-
|
50
|
-
parser.on('-d', '--debugger', 'Enable debugging.') do |o|
|
51
|
-
options[:debug] = true
|
52
|
-
end
|
53
|
-
|
54
|
-
parser.on('--fail-fast', 'Abort the run on first failure.') do |o|
|
55
|
-
options[:fail_fast] = true
|
56
|
-
end
|
57
|
-
|
58
|
-
parser.on('--failure-exit-code CODE', Integer, 'Override the exit code used when there are failing specs.') do |code|
|
59
|
-
options[:failure_exit_code] = code
|
60
|
-
end
|
61
|
-
|
62
|
-
parser.on('-X', '--[no-]drb', 'Run examples via DRb.') do |o|
|
63
|
-
options[:drb] = o
|
64
|
-
end
|
65
|
-
|
66
|
-
parser.on('--drb-port PORT', 'Port to connect to the DRb server.') do |o|
|
67
|
-
options[:drb_port] = o.to_i
|
68
|
-
end
|
69
|
-
|
70
|
-
parser.on('--init', 'Initialize your project with RSpec.') do |cmd|
|
71
|
-
ProjectInitializer.new(cmd).run
|
72
|
-
exit
|
73
|
-
end
|
74
|
-
|
75
|
-
parser.on('--configure', 'Deprecated. Use --init instead.') do |cmd|
|
76
|
-
warn "--configure is deprecated with no effect. Use --init instead."
|
77
|
-
exit
|
78
|
-
end
|
79
|
-
|
80
|
-
parser.separator("\n **** Output ****\n\n")
|
81
|
-
|
82
|
-
parser.on('-f', '--format FORMATTER', 'Choose a formatter.',
|
83
|
-
' [p]rogress (default - dots)',
|
84
|
-
' [d]ocumentation (group and example names)',
|
85
|
-
' [h]tml',
|
86
|
-
' [t]extmate',
|
87
|
-
' [j]son',
|
88
|
-
' custom formatter class name') do |o|
|
89
|
-
options[:formatters] ||= []
|
90
|
-
options[:formatters] << [o]
|
91
|
-
end
|
92
|
-
|
93
|
-
parser.on('-o', '--out FILE',
|
94
|
-
'Write output to a file instead of $stdout. This option applies',
|
95
|
-
' to the previously specified --format, or the default format',
|
96
|
-
' if no format is specified.'
|
97
|
-
) do |o|
|
98
|
-
options[:formatters] ||= [['progress']]
|
99
|
-
options[:formatters].last << o
|
100
|
-
end
|
101
|
-
|
102
|
-
parser.on('-b', '--backtrace', 'Enable full backtrace.') do |o|
|
103
|
-
options[:full_backtrace] = true
|
104
|
-
end
|
105
|
-
|
106
|
-
parser.on('-c', '--[no-]color', '--[no-]colour', 'Enable color in the output.') do |o|
|
107
|
-
options[:color] = o
|
108
|
-
end
|
109
|
-
|
110
|
-
parser.on('-p', '--[no-]profile [COUNT]', 'Enable profiling of examples and list the slowest examples (default: 10).') do |argument|
|
111
|
-
options[:profile_examples] = if argument.nil?
|
112
|
-
true
|
113
|
-
elsif argument == false
|
114
|
-
false
|
115
|
-
else
|
116
|
-
begin
|
117
|
-
Integer(argument)
|
118
|
-
rescue ArgumentError
|
119
|
-
Kernel.warn "Non integer specified as profile count, seperate " +
|
120
|
-
"your path from options with -- e.g. " +
|
121
|
-
"`rspec --profile -- #{argument}`"
|
122
|
-
true
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
parser.on('-w', '--warnings', 'Enable ruby warnings') do
|
128
|
-
options[:warnings] = true
|
129
|
-
end
|
130
|
-
|
131
|
-
parser.separator <<-FILTERING
|
132
|
-
|
133
|
-
**** Filtering/tags ****
|
134
|
-
|
135
|
-
In addition to the following options for selecting specific files, groups,
|
136
|
-
or examples, you can select a single example by appending the line number to
|
137
|
-
the filename:
|
138
|
-
|
139
|
-
rspec path/to/a_spec.rb:37
|
140
|
-
|
141
|
-
FILTERING
|
142
|
-
|
143
|
-
parser.on('-P', '--pattern PATTERN', 'Load files matching pattern (default: "spec/**/*_spec.rb").') do |o|
|
144
|
-
options[:pattern] = o
|
145
|
-
end
|
146
|
-
|
147
|
-
parser.on('-e', '--example STRING', "Run examples whose full nested names include STRING (may be",
|
148
|
-
" used more than once)") do |o|
|
149
|
-
(options[:full_description] ||= []) << Regexp.compile(Regexp.escape(o))
|
150
|
-
end
|
151
|
-
|
152
|
-
parser.on('-l', '--line-number LINE', 'Specify line number of an example or group (may be',
|
153
|
-
' used more than once).') do |o|
|
154
|
-
(options[:line_numbers] ||= []) << o
|
155
|
-
end
|
156
|
-
|
157
|
-
parser.on('-t', '--tag TAG[:VALUE]',
|
158
|
-
'Run examples with the specified tag, or exclude examples',
|
159
|
-
'by adding ~ before the tag.',
|
160
|
-
' - e.g. ~slow',
|
161
|
-
' - TAG is always converted to a symbol') do |tag|
|
162
|
-
filter_type = tag =~ /^~/ ? :exclusion_filter : :inclusion_filter
|
163
|
-
|
164
|
-
name,value = tag.gsub(/^(~@|~|@)/, '').split(':')
|
165
|
-
name = name.to_sym
|
166
|
-
|
167
|
-
options[filter_type] ||= {}
|
168
|
-
options[filter_type][name] = value.nil? ? true : eval(value) rescue value
|
169
|
-
end
|
170
|
-
|
171
|
-
parser.on('--default-path PATH', 'Set the default path where RSpec looks for examples (can',
|
172
|
-
' be a path to a file or a directory).') do |path|
|
173
|
-
options[:default_path] = path
|
174
|
-
end
|
175
|
-
|
176
|
-
parser.separator("\n **** Utility ****\n\n")
|
177
|
-
|
178
|
-
parser.on('--parallel-test NUMBER', 'Run the tests with the specified number of parallel threads (default: 1).') do |n|
|
179
|
-
options[:thread_maximum] = if !n.nil?
|
180
|
-
begin
|
181
|
-
Integer(n)
|
182
|
-
rescue ArgumentError
|
183
|
-
RSpec.warning "Non integer specified as number of parallel threads, seperate " +
|
184
|
-
"your path from options with a space e.g. " +
|
185
|
-
"`rspec --parallel-test #{n}`",
|
186
|
-
:call_site => nil
|
187
|
-
1
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
parser.on('-v', '--version', 'Display the version.') do
|
193
|
-
puts RSpec::Parallel::Version::STRING
|
194
|
-
exit
|
195
|
-
end
|
196
|
-
|
197
|
-
parser.on_tail('-h', '--help', "You're looking at it.") do
|
198
|
-
puts parser
|
199
|
-
exit
|
29
|
+
def parser(options, bypass = false)
|
30
|
+
if bypass
|
31
|
+
super(options)
|
32
|
+
else
|
33
|
+
OptionParser.new do |parser|
|
34
|
+
parser.banner = "\n **** Parallel Testing ****\n\n"
|
35
|
+
|
36
|
+
parser.on('--parallel-test NUMBER', Integer, 'Run the tests with the specified number of parallel threads (default: 1).') do |n|
|
37
|
+
puts "found --parallel-test with value of: #{n}"
|
38
|
+
options[:thread_maximum] = n || 1
|
39
|
+
end
|
40
|
+
|
41
|
+
parser.on('-v', '--version', 'Display the version.') do
|
42
|
+
puts "rspec-parallel: #{RSpec::Parallel::Version::STRING}"
|
43
|
+
end
|
44
|
+
|
45
|
+
parser.on_tail('-h', '--help', "You're looking at it.") do
|
46
|
+
puts parser
|
47
|
+
end
|
200
48
|
end
|
201
49
|
end
|
202
50
|
end
|