knapsack_pro 6.0.1 → 6.0.3

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
  SHA256:
3
- metadata.gz: 300a23bb327345712cf1a4c256073461ac22ac19d6aad51ab2a5c0676a6b5e3d
4
- data.tar.gz: 7a2f868e5ff853f1329f676266efd23f5b2c9a6b3a8348b3ed55558394b91d0e
3
+ metadata.gz: '05131444388481496f61779bc12d4bb749111cf798d667d969664b5bd2668e08'
4
+ data.tar.gz: 9fb9f32b315e914e4f089ff0946a8204017740a23cf2fede172f4276b29dfcd4
5
5
  SHA512:
6
- metadata.gz: f7a22a7ba6c8e36cf6a77149e081d07cf22053b8991252d62782332063ee92d8e42c943cdedeb8fac003fa56adcd328fa43d9c7e5e5a6c9f094a00b9a92a4905
7
- data.tar.gz: 197a2568354954113ac93a74b057b36a01ba7d6aa83ac255a6e1a0092f509abe64dc47ff95bffa2d4d1fd631727689eeaf0e8b46429efd708bc6f9268e6b0fd3
6
+ metadata.gz: 786fc53dbf7b6c068c2135b3f1d29218b17a1d5155db591088a4642442b281e387afa1b8815a9ccd3adfd88da86aded5158a7f5110e09d057a021aa5ef563891
7
+ data.tar.gz: f771d87b9dcd3c2dd19cc5058d7a9dc3a56e1a2101cbaeff1210bda562bd0670341ce6f3e2f341f32a1f1e5cd49a165c96cd36999f109a7dad87a3adf7cc25ae
data/CHANGELOG.md CHANGED
@@ -1,8 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ### 6.0.3
4
+
5
+ * fix(Turnip): make sure `.feature` files are recorded
6
+ * fix(RSpec): stop recording `UNKNOWN_PATH` that would generate an error in case of a CI node retry
7
+
8
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/233
9
+
10
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.2...v6.0.3
11
+
12
+ ### 6.0.2
13
+
14
+ * fix(RSpec): allow using `TimeTracker` in RSpec < 3.10.2 when formatters were required to expose `#output`
15
+
16
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/232
17
+
18
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.1...v6.0.2
19
+
3
20
  ### 6.0.1
4
21
 
5
- * fix(RSpec): allow to use Queue Mode for RSpec <= 3.10 when the `rspec_is_quitting` method is not present for RSpec World object
22
+ * fix(RSpec): allow using Queue Mode in RSpec <= 3.10 when the `rspec_is_quitting` method is not present for RSpec World object
6
23
 
7
24
  https://github.com/KnapsackPro/knapsack_pro-ruby/pull/231
8
25
 
@@ -65,7 +65,7 @@ module KnapsackPro
65
65
  ]
66
66
  .each do |path|
67
67
  p = path.call
68
- return p if p.include?('_spec.rb')
68
+ return p if p.include?('_spec.rb') || p.include?('.feature')
69
69
  end
70
70
 
71
71
  return ''
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'stringio'
4
+
3
5
  module KnapsackPro
4
6
  module Formatters
5
7
  class TimeTracker
@@ -10,10 +12,13 @@ module KnapsackPro
10
12
  :example_group_finished,
11
13
  :stop
12
14
 
15
+ attr_reader :output # RSpec < v3.10.2
16
+
13
17
  # Called at the beginning of each batch,
14
18
  # but only the first instance of this class is used,
15
19
  # so don't rely on the initializer to reset values.
16
20
  def initialize(_output)
21
+ @output = StringIO.new
17
22
  @time_each = nil
18
23
  @time_all = nil
19
24
  @before_all = 0.0
@@ -110,8 +115,9 @@ module KnapsackPro
110
115
 
111
116
  def record_example(accumulator, example, started_at)
112
117
  path = path_for(example)
113
- time_execution = time_execution_for(example, started_at)
118
+ return if path.nil?
114
119
 
120
+ time_execution = time_execution_for(example, started_at)
115
121
  if accumulator.key?(path)
116
122
  accumulator[path][:time_execution] += time_execution
117
123
  else
@@ -121,7 +127,8 @@ module KnapsackPro
121
127
 
122
128
  def path_for(example)
123
129
  file = file_path_for(example)
124
- return "UNKNOWN_PATH" if file == ""
130
+ return nil if file == ""
131
+
125
132
  path = rspec_split_by_test_example?(file) ? example.id : file
126
133
  KnapsackPro::TestFileCleaner.clean(path)
127
134
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KnapsackPro
4
- VERSION = '6.0.1'
4
+ VERSION = '6.0.3'
5
5
  end
@@ -305,6 +305,15 @@ describe KnapsackPro::Adapters::RSpecAdapter do
305
305
  expect(subject).to eq('')
306
306
  end
307
307
  end
308
+
309
+ context "when id does not end in .feature (nor _spec.rb)" do
310
+ it "returns the file_path" do
311
+ allow(current_example).to receive(:id).and_return("./foo.rb")
312
+ allow(current_example).to receive(:metadata).and_return(file_path: "./foo.feature")
313
+
314
+ expect(subject).to eq("./foo.feature")
315
+ end
316
+ end
308
317
  end
309
318
 
310
319
  describe 'bind methods' do
@@ -280,9 +280,9 @@ class TestTimeTracker
280
280
  SPEC
281
281
 
282
282
  run_specs(spec) do |spec_paths, times|
283
- raise unless times.size == 2
284
- raise unless times[0]["path"] == "UNKNOWN_PATH"
285
- raise unless times[1]["path"] == spec_paths.first
283
+ raise unless times.size == 1
284
+ raise unless times[0]["path"] == spec_paths.first
285
+ raise unless times[0]["time_execution"] == 0.0
286
286
  end
287
287
 
288
288
  ensure
@@ -431,7 +431,7 @@ class TestTimeTracker
431
431
  .queue(paths)
432
432
  .sort_by { |time| time["path"] }
433
433
  .filter do |time|
434
- paths.any? { |path| time["path"].start_with?(path) || time["path"] == "UNKNOWN_PATH" }
434
+ paths.any? { |path| time["path"].start_with?(path) }
435
435
  end
436
436
  yield(paths, times, time_tracker)
437
437
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-04 00:00:00.000000000 Z
11
+ date: 2023-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake