knapsack_pro 2.14.0 → 2.15.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
  SHA256:
3
- metadata.gz: ebb896076bc1dc61363682126869b0add7f9ca6a9a8dfde47c8b7472d3ebb2cb
4
- data.tar.gz: 86ee89293cbc0425c1d2c521c98983d4dd4d41954e614661979ca69e7d300c6b
3
+ metadata.gz: a97f9fbc29f0a109fbbf35b6a544f2ad86208feb697b7ff81f8458b679843c91
4
+ data.tar.gz: 434871e67293512331dfe99ed7915eb0f96ae27d2a7b3a1023e8752c752455ac
5
5
  SHA512:
6
- metadata.gz: 8caa055376e60414a8596a941782fa99d24f92bc6c7bb6fa4aa26937d645d7b217b4fcc091a6d277edfbad29caccc08c09ce2c07db03fa375f0891dc69d4c5b0
7
- data.tar.gz: d7f922e9a271d761f038eec7d1df91a86e51d54ad9e77dd304bba2507540ccae097269919861c8e1204e71f39f6c604fbd6d6555c097a3375a72bdfea5556451
6
+ metadata.gz: 3d5be26f0d227707d789b5d7243f3617ea6f839154725b555f0ada89b6600aef0b18aaa2532d018344c797a1f79465e27d3caadebb955d1ca00684b08f1be4ea
7
+ data.tar.gz: ddb85043aad801bbb9f47f51c36bace0c34b73f958968e821c7b2e8845cc0a302ef05d9e55033d260a86817d4a99d924084f8c29c86b87ce2c2a75fd96fef4af
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 2.15.0
4
+
5
+ * Do not allow to use the RSpec tag option together with the RSpec split by test examples feature
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/139
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.14.0...v2.15.0
10
+
3
11
  ### 2.14.0
4
12
 
5
13
  * Track time spend in RSpec context hook
@@ -14,12 +14,18 @@ module KnapsackPro
14
14
  runner = new(KnapsackPro::Adapters::RSpecAdapter)
15
15
 
16
16
  cli_args = (args || '').split
17
- # if user didn't provide the format then use explicitly default progress formatter
18
- # in order to avoid KnapsackPro::Formatters::RSpecQueueSummaryFormatter being the only default formatter
19
- if !cli_args.any? { |arg| arg.start_with?('-f') || arg.start_with?('--format')}
20
- cli_args += ['--format', 'progress']
17
+
18
+ if KnapsackPro::Config::Env.rspec_split_by_test_examples? && has_tag_option?(cli_args)
19
+ error_message = 'It is not allowed to use the RSpec tag option together with the RSpec split by test examples feature. Please see: https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it#warning-dont-use-rspec-tag-option'
20
+ KnapsackPro.logger.error(error_message)
21
+ raise error_message
21
22
  end
23
+
24
+ # when format option is not defined by user then use progress formatter to show tests execution progress
25
+ cli_args += ['--format', 'progress'] unless has_format_option?(cli_args)
26
+
22
27
  cli_args += [
28
+ # shows summary of all tests executed in Queue Mode at the very end
23
29
  '--format', KnapsackPro::Formatters::RSpecQueueSummaryFormatter.to_s,
24
30
  '--default-path', runner.test_dir,
25
31
  ]
@@ -148,6 +154,19 @@ module KnapsackPro
148
154
  ::RSpec.configuration.reset_filters
149
155
  end
150
156
  end
157
+
158
+ def self.has_tag_option?(cli_args)
159
+ # use start_with? because user can define tag option in a few ways:
160
+ # -t mytag
161
+ # -tmytag
162
+ # --tag mytag
163
+ # --tag=mytag
164
+ cli_args.any? { |arg| arg.start_with?('-t') || arg.start_with?('--tag') }
165
+ end
166
+
167
+ def self.has_format_option?(cli_args)
168
+ cli_args.any? { |arg| arg.start_with?('-f') || arg.start_with?('--format') }
169
+ end
151
170
  end
152
171
  end
153
172
  end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '2.14.0'
2
+ VERSION = '2.15.0'
3
3
  end
@@ -30,7 +30,7 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
30
30
  end
31
31
 
32
32
  context 'when args provided' do
33
- context 'when format param is not provided' do
33
+ context 'when format option is not provided' do
34
34
  let(:args) { '--example-arg example-value' }
35
35
 
36
36
  it 'uses default formatter progress' do
@@ -55,10 +55,10 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
55
55
  end
56
56
  end
57
57
 
58
- context 'when format param is provided as --format' do
58
+ context 'when format option is provided as --format' do
59
59
  let(:args) { '--format documentation' }
60
60
 
61
- it 'uses provided format param instead of default formatter progress' do
61
+ it 'uses provided format option instead of default formatter progress' do
62
62
  expected_exitstatus = 0
63
63
  expected_accumulator = {
64
64
  status: :completed,
@@ -80,10 +80,10 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
80
80
  end
81
81
  end
82
82
 
83
- context 'when format param is provided as -f' do
83
+ context 'when format option is provided as -f' do
84
84
  let(:args) { '-f d' }
85
85
 
86
- it 'uses provided format param instead of default formatter progress' do
86
+ it 'uses provided format option instead of default formatter progress' do
87
87
  expected_exitstatus = 0
88
88
  expected_accumulator = {
89
89
  status: :completed,
@@ -105,10 +105,10 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
105
105
  end
106
106
  end
107
107
 
108
- context 'when format param is provided without a delimiter' do
108
+ context 'when format option is provided without a delimiter' do
109
109
  let(:args) { '-fMyCustomFormatter' }
110
110
 
111
- it 'uses provided format param instead of default formatter progress' do
111
+ it 'uses provided format option instead of default formatter progress' do
112
112
  expected_exitstatus = 0
113
113
  expected_accumulator = {
114
114
  status: :completed,
@@ -129,6 +129,36 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
129
129
  subject
130
130
  end
131
131
  end
132
+
133
+ context 'when RSpec split by test examples feature is enabled' do
134
+ before do
135
+ expect(KnapsackPro::Config::Env).to receive(:rspec_split_by_test_examples?).and_return(true)
136
+ end
137
+
138
+ context 'when tag option is provided as --tag' do
139
+ let(:args) { '--tag example-value' }
140
+
141
+ it do
142
+ expect { subject }.to raise_error(/It is not allowed to use the RSpec tag option together with the RSpec split by test examples feature/)
143
+ end
144
+ end
145
+
146
+ context 'when tag option is provided as -t' do
147
+ let(:args) { '-t example-value' }
148
+
149
+ it do
150
+ expect { subject }.to raise_error(/It is not allowed to use the RSpec tag option together with the RSpec split by test examples feature/)
151
+ end
152
+ end
153
+
154
+ context 'when tag option is provided without delimiter' do
155
+ let(:args) { '-texample-value' }
156
+
157
+ it do
158
+ expect { subject }.to raise_error(/It is not allowed to use the RSpec tag option together with the RSpec split by test examples feature/)
159
+ end
160
+ end
161
+ end
132
162
  end
133
163
 
134
164
  context 'when args not provided' 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: 2.14.0
4
+ version: 2.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-15 00:00:00.000000000 Z
11
+ date: 2021-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake