knapsack_pro 3.2.1 → 3.3.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: d589b843abc560c3c17965cbda829fe472bb8eda866d090403c83157736b0246
4
- data.tar.gz: 237764ce934370152bc6372f735d42f4fb0e660d0a555b99fd51842561f835e8
3
+ metadata.gz: '099f5615951240d49a1087c5ebbb89169f161a35bfc2f0dc4ea7de80f188e3f9'
4
+ data.tar.gz: d4939ae9f79b358038147cd5f9a40dcee95760f1fa17d84314fc183cfad722a7
5
5
  SHA512:
6
- metadata.gz: 88a10b32de62fcc1e20ac7dbb1bb46a29dfa6072c188d396e4a772171b7667d105d61742b6f6a65af32125474566cf1d0108031fbf433bef4b54145995a3d615
7
- data.tar.gz: c3ade290ea5d7080a0fa9185ef75c5e180e85b4d9224c251198d722564330543e7c445e00eb4b2c77270345f8d2af78157565f076e25194ab22c6bc8af5fa802
6
+ metadata.gz: adfe023532b15509a4bc1cb993c3d259ffde7df5078c76cf7cf392ec5ce8b6f8eb322ca093e77eadf3ec0c8eba4748ccd0f5ccf6666fd3559eb3bd1a55c0893a
7
+ data.tar.gz: 072f8d809aa4600ed5f4987f39946cd0030faac8e4ca9bae08cf38680c3aef24226744023d5c6a74aa53b76c2fe481c35692b2f33b98ba9a8d85d17ddeb990c6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 3.3.0
4
+
5
+ * Show a JSON report file content when RSpec fails during a dry run
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/172
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.2.1...v3.3.0
10
+
3
11
  ### 3.2.1
4
12
 
5
13
  * Raise exception when using `:focus` tag to avoid skipping RSpec tests
@@ -36,11 +36,19 @@ module KnapsackPro
36
36
  ] + cli_args).join(' ')
37
37
 
38
38
  KnapsackPro.logger.error('-'*10 + ' START of actionable error message ' + '-'*50)
39
- KnapsackPro.logger.error('There was a problem while generating test examples for the slow test files using the RSpec dry-run flag. To reproduce the error triggered by the RSpec, please try to run below command (this way, you can find out what is causing the error):')
39
+ KnapsackPro.logger.error('RSpec (with a dry-run option) had a problem generating the report with test examples for the slow test files. Here is what you can do:')
40
+
41
+ KnapsackPro.logger.error("a) Please look for an error message from RSpec in the output above or below. If you don't see anything, that is fine. Sometimes RSpec does not produce any errors in the output.")
42
+
43
+ KnapsackPro.logger.error("b) Check if RSpec generated the report file #{report_path}. If the report exists, it may contain an error message. Here is a preview of the report file:")
44
+ KnapsackPro.logger.error(report_content || 'N/A')
45
+
46
+ KnapsackPro.logger.error('c) To reproduce the error manually, please run the following RSpec command. This way, you can find out what is causing the error. Please ensure you run the command in the same environment where the error occurred. For instance, if the error happens on the CI server, you should run the command in the CI environment:')
40
47
  KnapsackPro.logger.error(debug_cmd)
48
+
41
49
  KnapsackPro.logger.error('-'*10 + ' END of actionable error message ' + '-'*50)
42
50
 
43
- raise 'There was a problem while generating test examples for the slow test files. Please read actionable error message above.'
51
+ raise 'There was a problem while generating test examples for the slow test files. Please read the actionable error message above.'
44
52
  end
45
53
  end
46
54
 
@@ -75,6 +83,10 @@ module KnapsackPro
75
83
  "#{report_dir}/rspec_dry_run_json_report_node_#{KnapsackPro::Config::Env.ci_node_index}.json"
76
84
  end
77
85
 
86
+ def report_content
87
+ File.read(report_path) if File.exist?(report_path)
88
+ end
89
+
78
90
  def adapter_class
79
91
  KnapsackPro::Adapters::RSpecAdapter
80
92
  end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '3.2.1'
2
+ VERSION = '3.3.0'
3
3
  end
@@ -11,7 +11,7 @@ describe KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector do
11
11
 
12
12
  expect(FileUtils).to receive(:mkdir_p).with(report_dir)
13
13
 
14
- expect(File).to receive(:exist?).with(report_path).and_return(true)
14
+ expect(File).to receive(:exist?).at_least(:once).with(report_path).and_return(true)
15
15
  expect(File).to receive(:delete).with(report_path)
16
16
 
17
17
  expect(rspec_test_example_detector).to receive(:slow_test_files).and_return(test_file_entities)
@@ -68,8 +68,15 @@ describe KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector do
68
68
  context 'when exit code from RSpec::Core::Runner is 1' do
69
69
  let(:exit_code) { 1 }
70
70
 
71
+ before do
72
+ json_file = %{
73
+ {"version":"3.11.0","messages":["An error occurred while loading ./spec/a_spec.rb"],"examples":[],"summary":{"duration":3.6e-05,"example_count":0,"failure_count":0,"pending_count":0,"errors_outside_of_examples_count":1},"summary_line":"0 examples, 0 failures, 1 error occurred outside of examples"}
74
+ }.strip
75
+ expect(File).to receive(:read).with(report_path).and_return(json_file)
76
+ end
77
+
71
78
  it do
72
- expect { subject }.to raise_error(RuntimeError, 'There was a problem while generating test examples for the slow test files. Please read actionable error message above.')
79
+ expect { subject }.to raise_error(RuntimeError, 'There was a problem while generating test examples for the slow test files. Please read the actionable error message above.')
73
80
  end
74
81
  end
75
82
  end
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.2.1
4
+ version: 3.3.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-03-24 00:00:00.000000000 Z
11
+ date: 2022-07-11 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.32
408
+ rubygems_version: 3.3.7
409
409
  signing_key:
410
410
  specification_version: 4
411
411
  summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel