knapsack 1.14.1 → 1.15.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
  SHA1:
3
- metadata.gz: 17e19f79ce5fe6a536b8138b32a4f1a19336e299
4
- data.tar.gz: e31a13218770a3502655c1874388be080fc05128
3
+ metadata.gz: 88a3472c6e1c45824bd4d8774fedf2fe49346094
4
+ data.tar.gz: 396262940e1fc174523938abb47274e8aad33e59
5
5
  SHA512:
6
- metadata.gz: 1ea92ca2ee9e9070cacb6ffbea7c9f009d9ece71df6e3c7ef65a9889297d02c8290c9edbcf9e36c0d043dcf2624eaf31235c05164d3c2bed8cf6a22d676d1202
7
- data.tar.gz: 18c51cae4f2f8a27095b09b7d03626ece0739fa77136501f50c217f119acc569d1c7e418efcf1b52640f14ac2dbd665b0b341fc46e14e8a5c5baf3c053f1764a
6
+ metadata.gz: eb192cc001f8201e14fb2a46811fd06ebb53be23f14b49ec81308bc0f35dccf726b0ad63cc3cbf3f191fc29ff44a56edd96e7694a42569bdcc67d8af479a11ad
7
+ data.tar.gz: dab3225d6b4833d4edb57880768c5fba4f9f64b59cb4b454b1b9d635759ff66937a42afcd2b8f235427a14a3952bfaee23eeb6aa06a179451e3e0f16e39d9676
@@ -3,12 +3,11 @@ sudo: false
3
3
  language: ruby
4
4
  rvm:
5
5
  - 2.0.0
6
- - 2.1.5
7
- - 2.2.0
8
6
  - 2.2.2
9
7
  - 2.2.3
10
8
  - 2.3.0
11
9
  - 2.3.1
10
+ - 2.4.2
12
11
  addons:
13
12
  code_climate:
14
13
  repo_token: 38686058eed480dd0fcf8bce9015733e0bae88e44e30f4a1ac63df8aec2f86d8
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.15.0
6
+
7
+ * Add support for Cucumber 3.
8
+
9
+ https://github.com/ArturT/knapsack/pull/68
10
+
11
+ https://github.com/ArturT/knapsack/compare/v1.14.1...v1.15.0
12
+
5
13
  ### 1.14.1
6
14
 
7
15
  * Update RSpec timing adapter to be more resilient.
data/README.md CHANGED
@@ -12,6 +12,8 @@
12
12
  [codeclimate]: https://codeclimate.com/github/ArturT/knapsack
13
13
  [coverage]: https://codeclimate.com/github/ArturT/knapsack
14
14
 
15
+ Follow us on [Twitter @KnapsackPro](https://twitter.com/KnapsackPro) and give Like on [Facebook KnapsackPro](https://www.facebook.com/KnapsackPro)
16
+
15
17
  **Knapsack splits tests across CI nodes and makes sure that tests will run comparable time on each node.**
16
18
 
17
19
  Parallel tests across CI server nodes based on each test file's time execution. Knapsack generates a test time execution report and uses it for future test runs.
@@ -24,15 +26,21 @@ The knapsack gem supports:
24
26
  * [Spinach](https://github.com/codegram/spinach)
25
27
  * [Turnip](https://github.com/jnicklas/turnip)
26
28
 
27
- ### Without Knapsack
29
+ ### Without Knapsack - bad test suite split
28
30
 
29
31
  ![Without Knapsack gem](docs/images/without_knapsack.png)
30
32
 
31
- ### With Knapsack
33
+ ### With Knapsack - better test suite split
32
34
 
33
35
  ![With Knapsack gem](docs/images/with_knapsack.png)
34
36
 
35
- ### Features
37
+ ### With Knapsack Pro - optimal test suite split
38
+
39
+ [Watch 1 minute video how Queue Mode works](https://knapsackpro.com/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=video#x-play-how-it-works-video)
40
+
41
+ [![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/pkdLzKlnlQg/0.jpg)](https://knapsackpro.com/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=video#x-play-how-it-works-video)
42
+
43
+ ### Features in knapsack vs knapsack_pro
36
44
 
37
45
  | Feature | knapsack gem | knapsack_pro gem
38
46
  | --- | :---: | :---:
@@ -42,10 +50,6 @@ The knapsack gem supports:
42
50
  | Test suite split based on most up to date tests time execution data | ✘ | ✔
43
51
  | [Show all features](https://knapsackpro.com/features?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=show_all_features) | |
44
52
 
45
- __Play video how dynamic rspec allocation works__
46
-
47
- [![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/pkdLzKlnlQg/0.jpg)](https://knapsackpro.com/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=video#video)
48
-
49
53
  How knapsack_pro makes my life easier as opposed to regular knapsack gem?
50
54
 
51
55
  * The knapsack_pro version has queue mode designed for optimal test suite split thanks to dynamic tests allocation.
@@ -53,7 +57,7 @@ How knapsack_pro makes my life easier as opposed to regular knapsack gem?
53
57
  * The knapsack_pro version tracks all you branches so when your test code changes the knapsack_pro tries to provide you as optimal test suite split as possible.
54
58
  * When your test codebase changes over time you need to manually generate a new knapsack report in free gem version which is extra overhead and waste of time of the developer.
55
59
 
56
- **Would you like to try [knapsack_pro gem](https://github.com/KnapsackPro/knapsack_pro-ruby) with more features and free access for early users? Please [visit Knapsack Pro](http://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=try_knapsack_pro).**
60
+ **Only [knapsack_pro gem](https://github.com/KnapsackPro/knapsack_pro-ruby) has Queue Mode feature that saves optimal amount of time? Please [visit Knapsack Pro](http://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=try_knapsack_pro).**
57
61
 
58
62
  ### Presentations about knapsack gem
59
63
 
@@ -102,6 +106,7 @@ How knapsack_pro makes my life easier as opposed to regular knapsack gem?
102
106
  - [What time offset warning means?](#what-time-offset-warning-means)
103
107
  - [How to generate knapsack report?](#how-to-generate-knapsack-report)
104
108
  - [What does "leftover specs" mean?](#what-does-leftover-specs-mean)
109
+ - [Why some of test files are still in "leftover specs" after I generate a new report?](#why-some-of-test-files-are-still-in-leftover-specs-after-i-generate-a-new-report)
105
110
  - [How can I run tests from multiple directories?](#how-can-i-run-tests-from-multiple-directories)
106
111
  - [How to update existing knapsack report for a few test files?](#how-to-update-existing-knapsack-report-for-a-few-test-files)
107
112
  - [How to run tests for particular CI node in your development environment](#how-to-run-tests-for-particular-ci-node-in-your-development-environment)
@@ -356,6 +361,7 @@ Here is an example for test configuration in your `circleci.yml` file.
356
361
  For the first time run all tests on a single CI node with enabled report generator.
357
362
 
358
363
  ```yaml
364
+ # CircleCI 1.0
359
365
  test:
360
366
  override:
361
367
  # Step for RSpec
@@ -371,6 +377,37 @@ test:
371
377
  - KNAPSACK_GENERATE_REPORT=true bundle exec spinach
372
378
  ```
373
379
 
380
+ ```YAML
381
+ # CircleCI 2.0
382
+ - run:
383
+ name: Step for RSpec
384
+ command: |
385
+ # export word is important here!
386
+ export KNAPSACK_GENERATE_REPORT=true
387
+ bundle exec rspec spec
388
+
389
+ - run:
390
+ name: Step for Cucumber
391
+ command: |
392
+ # export word is important here!
393
+ export KNAPSACK_GENERATE_REPORT=true
394
+ bundle exec cucumber features
395
+
396
+ - run:
397
+ name: Step for Minitest
398
+ command: |
399
+ # export word is important here!
400
+ export KNAPSACK_GENERATE_REPORT=true
401
+ bundle exec rake test
402
+
403
+ - run:
404
+ name: Step for Spinach
405
+ command: |
406
+ # export word is important here!
407
+ export KNAPSACK_GENERATE_REPORT=true
408
+ bundle exec rspec spinach
409
+ ```
410
+
374
411
  After tests pass on your CircleCI machine your should copy knapsack json report which is rendered at the end of rspec/cucumber/minitest results. Save it into your repository as `knapsack_rspec_report.json`, `knapsack_cucumber_report.json`, `knapsack_minitest_report.json` or `knapsack_spinach_report.json` file and commit.
375
412
 
376
413
  #### Step 2
@@ -378,6 +415,7 @@ After tests pass on your CircleCI machine your should copy knapsack json report
378
415
  Now you should update test command and enable parallel. Please remember to add additional containers for your project in CircleCI settings.
379
416
 
380
417
  ```yaml
418
+ # CircleCI 1.0
381
419
  test:
382
420
  override:
383
421
  # Step for RSpec
@@ -397,6 +435,25 @@ test:
397
435
  parallel: true # Caution: there are 8 spaces indentation!
398
436
  ```
399
437
 
438
+ ```YAML
439
+ # CircleCI 2.0
440
+ - run:
441
+ name: Step for RSpec
442
+ command: bundle exec rake knapsack:rspec
443
+
444
+ - run:
445
+ name: Step for Cucumber
446
+ command: bundle exec rake knapsack:cucumber
447
+
448
+ - run:
449
+ name: Step for Minitest
450
+ command: bundle exec rake knapsack:minitest
451
+
452
+ - run:
453
+ name: Step for Spinach
454
+ command: bundle exec rake knapsack:spinach
455
+ ```
456
+
400
457
  Now everything should works. You will get warning at the end of rspec/cucumber/minitest results if time execution will take too much.
401
458
 
402
459
  ### Info for Travis users
@@ -652,6 +709,10 @@ The leftover specs mean we don't have recorded time execution for those test fil
652
709
  The reason might be that someone added a new test file after knapsack report was generated. Another reason might be an empty spec file.
653
710
  If you have a lot of leftover specs then you can [generate knapsack report again](#how-to-generate-knapsack-report) to improve you test distribution across CI nodes.
654
711
 
712
+ ### Why some of test files are still in "leftover specs" after I generate a new report?
713
+
714
+ If test file is empty or has only pending tests then it cannot be recorded so it will end up in leftovers specs list.
715
+
655
716
  ### How can I run tests from multiple directories?
656
717
 
657
718
  The test file pattern config option supports any glob pattern handled by [`Dir.glob`](http://ruby-doc.org/core-2.2.0/Dir.html#method-c-glob) and can be configured to pull test files from multiple directories. An example of this when using RSpec would be `"{spec,engines/**/spec}/**{,/*/**}/*_spec.rb"`. For complex cases like this, the test directory can't be extracted and must be specified manually using the `KNAPSACK_TEST_DIR` environment variable:
@@ -61,7 +61,11 @@ module Knapsack
61
61
  private
62
62
 
63
63
  def Around(*tag_expressions, &proc)
64
- ::Cucumber::RbSupport::RbDsl.register_rb_hook('around', tag_expressions, proc)
64
+ if ::Cucumber::VERSION.to_i >= 3
65
+ ::Cucumber::Glue::Dsl.register_rb_hook('around', tag_expressions, proc)
66
+ else
67
+ ::Cucumber::RbSupport::RbDsl.register_rb_hook('around', tag_expressions, proc)
68
+ end
65
69
  end
66
70
  end
67
71
  end
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.14.1'
2
+ VERSION = '1.15.0'
3
3
  end
@@ -1,11 +1,34 @@
1
1
  describe Knapsack::Adapters::CucumberAdapter do
2
2
  context do
3
- before do
4
- allow(::Cucumber::RbSupport::RbDsl).to receive(:register_rb_hook)
5
- allow(Kernel).to receive(:at_exit)
3
+ context 'when Cucumber version 1' do
4
+ before do
5
+ stub_const('Cucumber::VERSION', '1.3.20')
6
+ allow(::Cucumber::RbSupport::RbDsl).to receive(:register_rb_hook)
7
+ allow(Kernel).to receive(:at_exit)
8
+ end
9
+
10
+ it_behaves_like 'adapter'
11
+ end
12
+
13
+ context 'when Cucumber version 2' do
14
+ before do
15
+ stub_const('Cucumber::VERSION', '2')
16
+ allow(::Cucumber::RbSupport::RbDsl).to receive(:register_rb_hook)
17
+ allow(Kernel).to receive(:at_exit)
18
+ end
19
+
20
+ it_behaves_like 'adapter'
6
21
  end
7
22
 
8
- it_behaves_like 'adapter'
23
+ context 'when Cucumber version 3' do
24
+ before do
25
+ stub_const('Cucumber::VERSION', '3.0.0')
26
+ allow(::Cucumber::Glue::Dsl).to receive(:register_rb_hook)
27
+ allow(Kernel).to receive(:at_exit)
28
+ end
29
+
30
+ it_behaves_like 'adapter'
31
+ end
9
32
  end
10
33
 
11
34
  describe 'bind methods' do
@@ -1,5 +1,6 @@
1
- # https://github.com/cucumber/cucumber/blob/master/lib/cucumber/rb_support/rb_dsl.rb
2
1
  module Cucumber
2
+ # Cucumber 1 and 2
3
+ # https://github.com/cucumber/cucumber-ruby/blob/v2.99.0/lib/cucumber/rb_support/rb_dsl.rb
3
4
  module RbSupport
4
5
  class RbDsl
5
6
  class << self
@@ -9,4 +10,16 @@ module Cucumber
9
10
  end
10
11
  end
11
12
  end
13
+
14
+ # Cucumber 3
15
+ # https://github.com/cucumber/cucumber-ruby/blob/v3.0.0/lib/cucumber/glue/dsl.rb
16
+ module Glue
17
+ class Dsl
18
+ class << self
19
+ def register_rb_hook(phase, tag_names, proc)
20
+ proc.call
21
+ end
22
+ end
23
+ end
24
+ end
12
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.1
4
+ version: 1.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: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2017-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -286,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
286
  version: '0'
287
287
  requirements: []
288
288
  rubyforge_project:
289
- rubygems_version: 2.6.11
289
+ rubygems_version: 2.6.13
290
290
  signing_key:
291
291
  specification_version: 4
292
292
  summary: Knapsack splits tests across CI nodes and makes sure that tests will run