knapsack_pro 3.4.2 → 3.5.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
  SHA256:
3
- metadata.gz: 2b7ff9f0b6a3c331eb6c09ea0e04678152db2bae4248e47181bcffe6c88ee194
4
- data.tar.gz: 4ae766dc15f410d4c82baf223c5ca9abfce4a84c031a37693649e1b58e98b13a
3
+ metadata.gz: 171049202c4a6b8c4fb1a3d637dcb8d3aac83d8d6d2505c01535116df8437622
4
+ data.tar.gz: ecf5ed5065c0c73d7bfc4ad2b9cc6f77148fed7f62c60fcac4bb946d5cc93e8b
5
5
  SHA512:
6
- metadata.gz: 63ee85c13851d6d87b8d73c189eae9b477ccfb231b9119e1efbc1921142a31b7c82b85a425223cf8f60927b2de8a0b58e72ae77395844f78b6bc2711b0cfe13d
7
- data.tar.gz: 1b782f2383e2b583cb718e67b2a65feb0ee568378d09411aae80ac55a51e3fe243017ce179c6f3c6199e9fe7bf683dec0dd72465fa41a1f1b250bf50d231371d
6
+ metadata.gz: f930e4ea77b06784219c1e6013ce10429637dbcd566c1f05378aa57a698d815240f75c0779340804e240c3647a4c3a05a9815a67431771ff1b776e25a9bfeb2b
7
+ data.tar.gz: 73fc1741cf0b880a169dc2f36755b5d01914ad9238b60f873e85324778bb1520af1e34007c7b0d73e4c841440be8bdd8544f5ee97a0cd3340dc6b86171fe4303
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 3.5.0
4
+
5
+ * Add the `KnapsackPro::Hooks::Queue.before_subset_queue` hook in Queue Mode
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/183
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.4.2...v3.5.0
10
+
3
11
  ### 3.4.2
4
12
 
5
13
  * Fix: Load `rspec/core` in Regular Mode when using RSpec split by test examples feature
@@ -3,6 +3,7 @@ module KnapsackPro
3
3
  class Queue
4
4
  class << self
5
5
  attr_reader :before_queue_store,
6
+ :before_subset_queue_store,
6
7
  :after_subset_queue_store,
7
8
  :after_queue_store
8
9
 
@@ -10,6 +11,10 @@ module KnapsackPro
10
11
  @before_queue_store = nil
11
12
  end
12
13
 
14
+ def reset_before_subset_queue
15
+ @before_subset_queue_store = nil
16
+ end
17
+
13
18
  def reset_after_subset_queue
14
19
  @after_subset_queue_store = nil
15
20
  end
@@ -23,6 +28,11 @@ module KnapsackPro
23
28
  @before_queue_store << block
24
29
  end
25
30
 
31
+ def before_subset_queue(&block)
32
+ @before_subset_queue_store ||= []
33
+ @before_subset_queue_store << block
34
+ end
35
+
26
36
  def after_subset_queue(&block)
27
37
  @after_subset_queue_store ||= []
28
38
  @after_subset_queue_store << block
@@ -42,6 +52,16 @@ module KnapsackPro
42
52
  end
43
53
  end
44
54
 
55
+ def call_before_subset_queue
56
+ return unless before_subset_queue_store
57
+ before_subset_queue_store.each do |block|
58
+ block.call(
59
+ KnapsackPro::Config::Env.queue_id,
60
+ KnapsackPro::Config::Env.subset_queue_id
61
+ )
62
+ end
63
+ end
64
+
45
65
  def call_after_subset_queue
46
66
  return unless after_subset_queue_store
47
67
  after_subset_queue_store.each do |block|
@@ -60,6 +60,8 @@ module KnapsackPro
60
60
  KnapsackPro.tracker.reset!
61
61
  KnapsackPro.tracker.set_prerun_tests(test_file_paths)
62
62
 
63
+ KnapsackPro::Hooks::Queue.call_before_subset_queue
64
+
63
65
  all_test_file_paths += test_file_paths
64
66
 
65
67
  result_exitstatus = cucumber_run(runner, test_file_paths, args)
@@ -67,6 +67,8 @@ module KnapsackPro
67
67
  KnapsackPro.tracker.reset!
68
68
  KnapsackPro.tracker.set_prerun_tests(test_file_paths)
69
69
 
70
+ KnapsackPro::Hooks::Queue.call_before_subset_queue
71
+
70
72
  all_test_file_paths += test_file_paths
71
73
 
72
74
  result = minitest_run(runner, test_file_paths, args)
@@ -82,6 +82,8 @@ module KnapsackPro
82
82
  KnapsackPro.tracker.reset!
83
83
  KnapsackPro.tracker.set_prerun_tests(test_file_paths)
84
84
 
85
+ KnapsackPro::Hooks::Queue.call_before_subset_queue
86
+
85
87
  all_test_file_paths += test_file_paths
86
88
  cli_args = args + test_file_paths
87
89
 
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '3.4.2'
2
+ VERSION = '3.5.0'
3
3
  end
@@ -37,6 +37,46 @@ describe KnapsackPro::Hooks::Queue do
37
37
  end
38
38
  end
39
39
 
40
+ describe '.call_before_subset_queue' do
41
+ subject { described_class.call_before_subset_queue }
42
+
43
+ context 'when callback is not set' do
44
+ before do
45
+ described_class.reset_before_subset_queue
46
+ end
47
+
48
+ it { should be_nil }
49
+ end
50
+
51
+ context 'when callback is set multiple times' do
52
+ let(:queue_id) { double }
53
+ let(:subset_queue_id) { double }
54
+
55
+ before do
56
+ expect(KnapsackPro::Config::Env).to receive(:queue_id).twice.and_return(queue_id)
57
+ expect(KnapsackPro::Config::Env).to receive(:subset_queue_id).twice.and_return(subset_queue_id)
58
+
59
+ $expected_called_blocks = []
60
+
61
+ described_class.before_subset_queue do |q_id, subset_q_id|
62
+ $expected_called_blocks << [:block_1_called, q_id, subset_q_id]
63
+ end
64
+ described_class.before_subset_queue do |q_id, subset_q_id|
65
+ $expected_called_blocks << [:block_2_called, q_id, subset_q_id]
66
+ end
67
+ end
68
+
69
+ it 'each block is called' do
70
+ subject
71
+
72
+ expect($expected_called_blocks).to eq([
73
+ [:block_1_called, queue_id, subset_queue_id],
74
+ [:block_2_called, queue_id, subset_queue_id],
75
+ ])
76
+ end
77
+ end
78
+ end
79
+
40
80
  describe '.call_after_subset_queue' do
41
81
  subject { described_class.call_after_subset_queue }
42
82
 
@@ -115,6 +115,8 @@ describe KnapsackPro::Runners::Queue::CucumberRunner do
115
115
  expect(tracker).to receive(:reset!)
116
116
  expect(tracker).to receive(:set_prerun_tests).with(test_file_paths)
117
117
 
118
+ expect(KnapsackPro::Hooks::Queue).to receive(:call_before_subset_queue)
119
+
118
120
  # .cucumber_run
119
121
  expect(Kernel).to receive(:system).with('bundle exec cucumber --retry 5 --no-strict-flaky --require fake-features-dir -- "features/a.feature" "features/b.feature"')
120
122
 
@@ -125,6 +125,7 @@ describe KnapsackPro::Runners::Queue::MinitestRunner do
125
125
 
126
126
  expect(Minitest::Runnable).to receive(:reset)
127
127
 
128
+ expect(KnapsackPro::Hooks::Queue).to receive(:call_before_subset_queue)
128
129
 
129
130
  expect(KnapsackPro::Hooks::Queue).to receive(:call_after_subset_queue)
130
131
 
@@ -225,6 +225,8 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
225
225
 
226
226
  expect(described_class).to receive(:rspec_clear_examples)
227
227
 
228
+ expect(KnapsackPro::Hooks::Queue).to receive(:call_before_subset_queue)
229
+
228
230
  expect(KnapsackPro::Hooks::Queue).to receive(:call_after_subset_queue)
229
231
 
230
232
  expect(KnapsackPro::Report).to receive(:save_subset_queue_to_file)
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: 3.4.2
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-21 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake