rspec-multiprocess_runner 0.2.3 → 0.3.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
  SHA1:
3
- metadata.gz: 203c3b7bd50cc7c856265414ea8bcf734f09c8f8
4
- data.tar.gz: d92e105f0f5aecff2723fc65ccc46db29bd16f4c
3
+ metadata.gz: 4d891049e0122f0b95c00eab92191c798e68d533
4
+ data.tar.gz: 7ddbae3e691ed2ab6d2121e7a362ea61a279e680
5
5
  SHA512:
6
- metadata.gz: 1b678c0f53864275c7e7244d9b9c09c60524217dc9ae639062a66267574c2ae6d6c38c5f8bfc7ee9bad965e4aa6fbe4934533ba81bf66515a815e9d5a0c9fdf8
7
- data.tar.gz: bf55bb27e8253464dd181f8f2289b6079d90bc292ea1f54d2bb13da4cd69750b93728f649b625b87a034134f74117834d8d06e164295f9394e78c621e6a118ba
6
+ metadata.gz: e8fe6572977652575bb0d8073222f65a0cd0b1c696b2ee2ce51bd9e2d6133d4c749610c094956f7f1c27e0b3942a3297858563f2c86d30d6c412f3f196f358b4
7
+ data.tar.gz: def29fc93cb9a4e822bf08c7f16a923d701b2b74959625db36933001abce6000e3fd8f6e3930f1d5b4dd0bf8b57e8e99a9af5dd9716abf11566b1dfc4d789ccb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
+ # 0.3.0
2
+
3
+ * Require a filename for the `--log-failing-files` option (#9)
4
+ * Exit status for `multirspec` is only 0 on success and is always non-zero when
5
+ there is any sort of failure (#8)
6
+
1
7
  # 0.2.3
2
8
 
9
+ * Add `--log-failing-files` option (#7)
3
10
 
4
11
  # 0.2.2
5
12
 
data/exe/multirspec CHANGED
@@ -30,9 +30,4 @@ end
30
30
 
31
31
  success = coordinator.run
32
32
 
33
- status = if options.log_failing_files
34
- 0
35
- else
36
- success ? 0 : 1
37
- end
38
- exit(status)
33
+ exit(success ? 0 : 1)
@@ -13,7 +13,7 @@ module RSpec::MultiprocessRunner
13
13
  self.file_timeout_seconds = nil
14
14
  self.example_timeout_seconds = 15
15
15
  self.pattern = "**/*_spec.rb"
16
- self.log_failing_files = false
16
+ self.log_failing_files = nil
17
17
  self.rspec_options = []
18
18
  end
19
19
 
@@ -88,8 +88,8 @@ module RSpec::MultiprocessRunner
88
88
  self.pattern = pattern
89
89
  end
90
90
 
91
- parser.on("--log-failing-files", "Write failing spec files to multiprocess.failures") do |bool|
92
- self.log_failing_files = bool
91
+ parser.on("--log-failing-files FILENAME", "Filename to log failing files to") do |filename|
92
+ self.log_failing_files = filename
93
93
  end
94
94
 
95
95
  parser.on_tail("-h", "--help", "Prints this help") do
@@ -175,7 +175,6 @@ module RSpec::MultiprocessRunner
175
175
  by_status_and_time = combine_example_results.each_with_object({}) do |result, idx|
176
176
  (idx[result.status] ||= []) << result
177
177
  end
178
- count_examples(by_status_and_time)
179
178
 
180
179
  print_skipped_files_details
181
180
  print_pending_example_details(by_status_and_time["pending"])
@@ -196,13 +195,6 @@ module RSpec::MultiprocessRunner
196
195
  (@workers + @stopped_workers).detect { |w| w.example_results.detect { |r| r.status == "failed" } }
197
196
  end
198
197
 
199
- def count_examples(example_results)
200
- @metadata = {}
201
- @metadata[:example_count] = example_results.map { |status, results| results.size }.inject(0) { |sum, ct| sum + ct }
202
- @metadata[:failure_count] = example_results["failed"] ? example_results["failed"].size : 0
203
- @metadata[:pending_count] = example_results["pending"] ? example_results["pending"].size : 0
204
- end
205
-
206
198
  def print_skipped_files_details
207
199
  return if @spec_files.empty?
208
200
  puts
@@ -235,7 +227,6 @@ module RSpec::MultiprocessRunner
235
227
 
236
228
  def log_failed_files(failed_example_results)
237
229
  return if failed_example_results.nil?
238
- return if failed_example_results.size > @metadata[:example_count] / 10.0
239
230
 
240
231
  failing_files = Hash.new { |h, k| h[k] = 0 }
241
232
  failed_example_results.each do |failure|
@@ -243,8 +234,8 @@ module RSpec::MultiprocessRunner
243
234
  end
244
235
 
245
236
  puts
246
- puts "Writing failures to file: multiprocess.failures"
247
- File.open("multiprocess.failures", "w+") do |io|
237
+ puts "Writing failures to file: #{@log_failing_files}"
238
+ File.open(@log_failing_files, "w+") do |io|
248
239
  failing_files.each do |(k, _)|
249
240
  io << k
250
241
  io << "\n"
@@ -258,13 +249,16 @@ module RSpec::MultiprocessRunner
258
249
  end
259
250
 
260
251
  def print_example_counts(by_status_and_time)
252
+ example_count = by_status_and_time.map { |status, results| results.size }.inject(0) { |sum, ct| sum + ct }
253
+ failure_count = by_status_and_time["failed"] ? by_status_and_time["failed"].size : 0
254
+ pending_count = by_status_and_time["pending"] ? by_status_and_time["pending"].size : 0
261
255
  process_failure_count = failed_workers.size
262
256
  skipped_count = @spec_files.size
263
257
 
264
258
  # Copied from RSpec
265
- summary = pluralize(@metadata[:example_count], "example")
266
- summary << ", " << pluralize(@metadata[:failure_count], "failure")
267
- summary << ", #{@metadata[:pending_count]} pending" if @metadata[:pending_count] > 0
259
+ summary = pluralize(example_count, "example")
260
+ summary << ", " << pluralize(failure_count, "failure")
261
+ summary << ", #{pending_count} pending" if pending_count > 0
268
262
  summary << ", " << pluralize(process_failure_count, "failed proc") if process_failure_count > 0
269
263
  summary << ", " << pluralize(skipped_count, "skipped file") if skipped_count > 0
270
264
  puts summary
@@ -52,6 +52,8 @@ module RSpec::MultiprocessRunner
52
52
  # rspec binary from the loaded rspec-core gem.
53
53
  attr_accessor :multirspec_path
54
54
 
55
+ # Filename to which to append a list of the files containing specs that
56
+ # failed.
55
57
  attr_accessor :log_failing_files
56
58
 
57
59
  # Command line options to pass to the RSpec workers. Defaults to `nil`.
@@ -110,7 +112,7 @@ module RSpec::MultiprocessRunner
110
112
  cmd_parts << '--pattern' << pattern
111
113
  end
112
114
  if log_failing_files
113
- cmd_parts << '--log-failing-files'
115
+ cmd_parts << '--log-failing-files' << log_failing_files
114
116
  end
115
117
  if files_or_directories
116
118
  cmd_parts.concat(files_or_directories)
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module MultiprocessRunner
3
- VERSION = "0.2.3"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-multiprocess_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rhett Sutphin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-12 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core