knapsack_pro 2.0.0 → 2.1.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: 575934b81520ce3bbf894d8cf643ae5af0279fd43b0529c62d8a4b71a595fbc8
4
- data.tar.gz: dbebdb5c243e9a363a0f4737d4d78d9c2f1ff66f18e8087faafaece2299998eb
3
+ metadata.gz: fccaa38fe31152f32d7cdd09f7b42eb7e487c7e1c277fb498dc36b13a3356bc4
4
+ data.tar.gz: 8611e4cf6c14f3eb86c7b45a2c90df7e33c3500b6f30e86fd1ba596635585479
5
5
  SHA512:
6
- metadata.gz: e636160f7c6793f371840b481154a7bcb6a5215580f5d5a92cd4be21242a544bc3c6bbf6c64d92da66fb2228e20f1ccf3836408405881c460c85472b0f3fbcb4
7
- data.tar.gz: 41375edcb7f40c0044bacba75a89f0e43766261db0c148b525a565580592ad08df3cc9f37843fd056bc29ef79e0e3437266512cbdb6ddc7ce81219ee5ba92edf
6
+ metadata.gz: bd0174542079eab755f963314a17fe804cedce37366074fabc0e169547af7a89f27516f2c48e2052c21b2aa86d24703d17d19d40b8ac29eaacab51f030d51de6
7
+ data.tar.gz: 21010bce7d72dc251d85b8d4d04949ceb8f2931eab99be18df2cbafa1479ff062f0e159b599b8b8bde9ef78f71400d2ce0b1724647509ded42018b952a0511ca
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 2.1.0
4
+
5
+ * Add `KNAPSACK_PRO_RSPEC_TEST_EXAMPLE_DETECTOR_PREFIX` to customize prefix for generating test examples report when using RSpec split by test examples
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/118
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.0.0...v2.1.0
10
+
3
11
  ### 2.0.0
4
12
 
5
13
  * Add support for CI build ID for Github Actions
data/README.md CHANGED
@@ -84,6 +84,7 @@ We keep this old FAQ in README to not break old links spread across the web. You
84
84
  - [Supported test runners in queue mode](#supported-test-runners-in-queue-mode)
85
85
  - [Split test files by test cases](#split-test-files-by-test-cases)
86
86
  - [RSpec split test files by test examples (by individual `it`s)](#rspec-split-test-files-by-test-examples-by-individual-its)
87
+ - [Why I see error: Don't know how to build task 'knapsack_pro:rspec_test_example_detector'?](#why-i-see-error-dont-know-how-to-build-task-knapsack_prorspec_test_example_detector)
87
88
  - [How to manually define a list of slow test files to be split by test cases](#how-to-manually-define-a-list-of-slow-test-files-to-be-split-by-test-cases)
88
89
  - [Extra configuration for CI server](#extra-configuration-for-ci-server)
89
90
  - [Info about ENV variables](#info-about-env-variables)
@@ -618,6 +619,16 @@ KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
618
619
 
619
620
  Thanks to that your CI build speed can be faster. We recommend using this feature with [Queue Mode](https://youtu.be/hUEB1XDKEFY) to ensure parallel CI nodes finish work at a similar time which gives you the shortest CI build time.
620
621
 
622
+ #### Why I see error: Don't know how to build task 'knapsack_pro:rspec_test_example_detector'?
623
+
624
+ If you will see error like:
625
+
626
+ ```
627
+ Don't know how to build task 'knapsack_pro:rspec_test_example_detector' (See the list of available tasks with `rake --tasks`)
628
+ ```
629
+
630
+ It probably means bundler can't find the rake task. You can try remove default prefix `bundle exec` used by knapsack_pro gem by setting `KNAPSACK_PRO_RSPEC_TEST_EXAMPLE_DETECTOR_PREFIX=""`.
631
+
621
632
  ### How to manually define a list of slow test files to be split by test cases
622
633
 
623
634
  If you don't want to rely on a list of test files from Knapsack Pro API to determine slow test files that should be split by test cases then you can define your own list of slow test files.
@@ -43,7 +43,12 @@ module KnapsackPro
43
43
  KnapsackPro.logger.info("Generating RSpec test examples JSON report for slow test files to prepare it to be split by test examples (by individual 'it's. Thanks to that a single slow test file can be split across parallel CI nodes). Analyzing #{slow_test_files.size} slow test files.")
44
44
 
45
45
  # generate RSpec JSON report in separate process to not pollute RSpec state
46
- cmd = 'RACK_ENV=test RAILS_ENV=test bundle exec rake knapsack_pro:rspec_test_example_detector'
46
+ cmd = [
47
+ 'RACK_ENV=test',
48
+ 'RAILS_ENV=test',
49
+ KnapsackPro::Config::Env.rspec_test_example_detector_prefix,
50
+ 'rake knapsack_pro:rspec_test_example_detector',
51
+ ].join(' ')
47
52
  unless Kernel.system(cmd)
48
53
  raise "Could not generate JSON report for RSpec. Rake task failed when running #{cmd}"
49
54
  end
@@ -179,6 +179,10 @@ module KnapsackPro
179
179
  rspec_split_by_test_examples.to_s == 'true'
180
180
  end
181
181
 
182
+ def rspec_test_example_detector_prefix
183
+ ENV.fetch('KNAPSACK_PRO_RSPEC_TEST_EXAMPLE_DETECTOR_PREFIX', 'bundle exec')
184
+ end
185
+
182
186
  def test_suite_token
183
187
  env_name = 'KNAPSACK_PRO_TEST_SUITE_TOKEN'
184
188
  ENV[env_name] || raise("Missing environment variable #{env_name}. You should set environment variable like #{env_name}_RSPEC (note there is suffix _RSPEC at the end). knapsack_pro gem will set #{env_name} based on #{env_name}_RSPEC value. If you use other test runner than RSpec then use proper suffix.")
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1.0'
3
3
  end
@@ -658,6 +658,20 @@ describe KnapsackPro::Config::Env do
658
658
  end
659
659
  end
660
660
 
661
+ describe '.rspec_test_example_detector_prefix' do
662
+ subject { described_class.rspec_test_example_detector_prefix }
663
+
664
+ context 'when ENV exists' do
665
+ before { stub_const("ENV", { 'KNAPSACK_PRO_RSPEC_TEST_EXAMPLE_DETECTOR_PREFIX' => '' }) }
666
+ it { should eq '' }
667
+ end
668
+
669
+ context "when ENV doesn't exist" do
670
+ before { stub_const("ENV", {}) }
671
+ it { should eq 'bundle exec' }
672
+ end
673
+ end
674
+
661
675
  describe '.test_suite_token' do
662
676
  subject { described_class.test_suite_token }
663
677
 
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.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-27 00:00:00.000000000 Z
11
+ date: 2020-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake