knapsack_pro 3.1.3 → 3.2.1
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 +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/knapsack_pro/adapters/rspec_adapter.rb +17 -0
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +29 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d589b843abc560c3c17965cbda829fe472bb8eda866d090403c83157736b0246
|
4
|
+
data.tar.gz: 237764ce934370152bc6372f735d42f4fb0e660d0a555b99fd51842561f835e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88a10b32de62fcc1e20ac7dbb1bb46a29dfa6072c188d396e4a772171b7667d105d61742b6f6a65af32125474566cf1d0108031fbf433bef4b54145995a3d615
|
7
|
+
data.tar.gz: c3ade290ea5d7080a0fa9185ef75c5e180e85b4d9224c251198d722564330543e7c445e00eb4b2c77270345f8d2af78157565f076e25194ab22c6bc8af5fa802
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 3.2.1
|
4
|
+
|
5
|
+
* Raise exception when using `:focus` tag to avoid skipping RSpec tests
|
6
|
+
|
7
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/167
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.2.0...v3.2.1
|
10
|
+
|
11
|
+
### 3.2.0
|
12
|
+
|
13
|
+
* Add an error message to `KnapsackPro::Adapters::RspecAdapter#bind`
|
14
|
+
|
15
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/165
|
16
|
+
|
17
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.1.3...v3.2.0
|
18
|
+
|
3
19
|
### 3.1.3
|
4
20
|
|
5
21
|
* Run Fallback Mode when `Errno::ECONNRESET` exception happens
|
@@ -62,6 +62,10 @@ module KnapsackPro
|
|
62
62
|
current_test_path
|
63
63
|
end
|
64
64
|
|
65
|
+
if example.metadata[:focus] && KnapsackPro::Adapters::RSpecAdapter.rspec_configuration.filter.rules[:focus]
|
66
|
+
raise "We detected a test file path #{current_test_path} with a test using the metadata `:focus` tag. RSpec might not run some tests in the Queue Mode (causing random tests skipping problem). Please remove the `:focus` tag from your codebase. See more: https://knapsackpro.com/faq/question/rspec-is-not-running-some-tests"
|
67
|
+
end
|
68
|
+
|
65
69
|
example.run
|
66
70
|
end
|
67
71
|
|
@@ -95,12 +99,25 @@ module KnapsackPro
|
|
95
99
|
end
|
96
100
|
end
|
97
101
|
end
|
102
|
+
|
103
|
+
private
|
104
|
+
|
105
|
+
# Hide RSpec configuration so that we could mock it in the spec.
|
106
|
+
# Mocking existing RSpec configuration could impact test's runtime.
|
107
|
+
def self.rspec_configuration
|
108
|
+
::RSpec.configuration
|
109
|
+
end
|
98
110
|
end
|
99
111
|
|
100
112
|
# This is added to provide backwards compatibility
|
101
113
|
# In case someone is doing switch from knapsack gem to the knapsack_pro gem
|
102
114
|
# and didn't notice the class name changed
|
103
115
|
class RspecAdapter < RSpecAdapter
|
116
|
+
def self.bind
|
117
|
+
error_message = 'You have attempted to call KnapsackPro::Adapters::RspecAdapter.bind. Please switch to using the new class name: KnapsackPro::Adapters::RSpecAdapter. See https://docs.knapsackpro.com/knapsack_pro-ruby/guide for up-to-date configuration instructions.'
|
118
|
+
KnapsackPro.logger.error(error_message)
|
119
|
+
raise error_message
|
120
|
+
end
|
104
121
|
end
|
105
122
|
end
|
106
123
|
end
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -175,7 +175,35 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
175
175
|
let(:logger) { instance_double(Logger) }
|
176
176
|
let(:global_time) { 'Global time: 01m 05s' }
|
177
177
|
let(:test_path) { 'spec/a_spec.rb' }
|
178
|
-
let(:current_example) { double }
|
178
|
+
let(:current_example) { double(metadata: {}) }
|
179
|
+
|
180
|
+
context "when the example's metadata has :focus tag AND RSpec inclusion rule includes :focus" do
|
181
|
+
let(:current_example) { double(metadata: { focus: true }) }
|
182
|
+
|
183
|
+
it do
|
184
|
+
expect(KnapsackPro::Config::Env).to receive(:rspec_split_by_test_examples?).and_return(false)
|
185
|
+
|
186
|
+
expect(config).to receive(:prepend_before).with(:context).and_yield
|
187
|
+
|
188
|
+
allow(KnapsackPro).to receive(:tracker).and_return(tracker)
|
189
|
+
expect(tracker).to receive(:start_timer).ordered
|
190
|
+
|
191
|
+
expect(config).to receive(:around).with(:each).and_yield(current_example)
|
192
|
+
expect(::RSpec).to receive(:configure).and_yield(config)
|
193
|
+
|
194
|
+
expect(tracker).to receive(:stop_timer).ordered
|
195
|
+
|
196
|
+
expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
|
197
|
+
|
198
|
+
expect(tracker).to receive(:current_test_path=).with(test_path).ordered
|
199
|
+
|
200
|
+
expect(described_class).to receive_message_chain(:rspec_configuration, :filter, :rules, :[]).with(:focus).and_return(true)
|
201
|
+
|
202
|
+
expect {
|
203
|
+
subject.bind_time_tracker
|
204
|
+
}.to raise_error /We detected a test file path spec\/a_spec\.rb with a test using the metadata `:focus` tag/
|
205
|
+
end
|
206
|
+
end
|
179
207
|
|
180
208
|
context 'when rspec split by test examples is disabled' do
|
181
209
|
before do
|
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.1
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -405,7 +405,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
405
405
|
- !ruby/object:Gem::Version
|
406
406
|
version: '0'
|
407
407
|
requirements: []
|
408
|
-
rubygems_version: 3.2.
|
408
|
+
rubygems_version: 3.2.32
|
409
409
|
signing_key:
|
410
410
|
specification_version: 4
|
411
411
|
summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
|