parallel_coverage 0.1.0 → 0.1.5
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/README.md +68 -0
- data/Rakefile +1 -0
- data/lib/parallel_coverage.rb +47 -0
- data/lib/parallel_coverage/engine.rb +13 -0
- data/lib/parallel_coverage/version.rb +5 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc5d1cd0fa84d14a150c10599dc01ab5756b7da9ed882a7d2605e244bf40aaf4
|
4
|
+
data.tar.gz: 8a5806d245400211adc8db05357d3b4f17d696ae38a4d786a1c8c9415fc67eeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3b33c3dd152355c254b0d6065bc98b0944ea71b9e5fe5fb211cfcc54afe98cc905343bda7a8f5e70da291e44ec7f107a936784a6ed34e1ecbf1480b8088c56f
|
7
|
+
data.tar.gz: e142a278a4e47029f0337f18333079703f40e3d484ecfa730e020a48dc95a5603ac59e1fa52daa04413e86a4b260cef46521ed2a9bc5c81816f01e9df91e3e80
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Parallel Coverage
|
2
|
+
Rails engine that gets SimpleCov up and running for you in a parallelized test suite.
|
3
|
+
|
4
|
+
This gem sets an initializer to run the coverage measurement instead of running it directly at the beginning of the tests themselves, so it is more suitable for a fully featured tests suite (i.e. with integration tests) rather than unit tests only.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
Add this lines to your application's Gemfile:
|
8
|
+
```ruby
|
9
|
+
group :test do
|
10
|
+
gem 'parallel_coverage'
|
11
|
+
end
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
Run your tests through CLI with the `COVERAGE` environment variable set to true:
|
16
|
+
```
|
17
|
+
COVERAGE=true bin/rails test:system test
|
18
|
+
```
|
19
|
+
|
20
|
+
The default SimpleCov config passed to the `SimpleCov.start 'rails'` call is the following:
|
21
|
+
```ruby
|
22
|
+
track_files 'app/**/*.rb'
|
23
|
+
|
24
|
+
add_filter '/bin/'
|
25
|
+
add_filter '/config/'
|
26
|
+
add_filter '/db/'
|
27
|
+
add_filter '/lib/'
|
28
|
+
add_filter '/test/'
|
29
|
+
add_filter 'vendor'
|
30
|
+
add_filter 'node_modules'
|
31
|
+
add_filter '/Rakefile'
|
32
|
+
add_filter '/app/controllers/admin/'
|
33
|
+
|
34
|
+
add_group 'Services', 'app/services'
|
35
|
+
```
|
36
|
+
We assume that admin controllers are not critical enought to be tracked in the coverage, but if you need to, you can override those settings by adding a `config/initializers/coverage.rb` with:
|
37
|
+
```ruby
|
38
|
+
ParallelCoverage.simple_cov_config = proc do
|
39
|
+
add_filter '/my/awesome/filter1'
|
40
|
+
add_filter '/my/awesome/filter2'
|
41
|
+
...
|
42
|
+
end
|
43
|
+
```
|
44
|
+
Keep in mind that by doing this you will totally disable the default config, so you'll have to put it back in your `config/initializers/coverage.rb` if you want to extend the config.
|
45
|
+
|
46
|
+
## Release
|
47
|
+
Before all, configure your credentials for RubyGems :
|
48
|
+
|
49
|
+
1. Login to RubyGems
|
50
|
+
2. Create a token which have rights to push gems (https://rubygems.org/profile/api_keys)
|
51
|
+
3. Add it to your config:
|
52
|
+
```
|
53
|
+
echo ":rubygems_api_key: YOUR_API_KEY" >> ~/.gem/credentials
|
54
|
+
```
|
55
|
+
|
56
|
+
You just have to run default command:
|
57
|
+
```
|
58
|
+
rake release
|
59
|
+
```
|
60
|
+
|
61
|
+
Else, to publish a new version of this gem, you'll need to build it with
|
62
|
+
`gem build parallel_coverage.gemspec` and then push it manually:
|
63
|
+
```
|
64
|
+
gem push parallel_coverage-X.X.X.gem
|
65
|
+
```
|
66
|
+
|
67
|
+
## License
|
68
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). Copyright 2021 Codeur SARL.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'parallel_coverage/version'
|
4
|
+
require 'parallel_coverage/engine'
|
5
|
+
|
6
|
+
class ParallelCoverage
|
7
|
+
cattr_accessor :simple_cov_config
|
8
|
+
|
9
|
+
def self.run_coverage
|
10
|
+
return unless ENV['COVERAGE']
|
11
|
+
|
12
|
+
require 'simplecov'
|
13
|
+
|
14
|
+
SimpleCov.start 'rails', &simple_cov_config
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.parallelize_coverage
|
18
|
+
return unless ENV['COVERAGE']
|
19
|
+
|
20
|
+
ActiveSupport::TestCase.parallelize_setup do |worker|
|
21
|
+
SimpleCov.command_name "#{SimpleCov.command_name}-#{worker}"
|
22
|
+
end
|
23
|
+
|
24
|
+
ActiveSupport::TestCase.parallelize_teardown do
|
25
|
+
SimpleCov.result
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
ParallelCoverage.simple_cov_config = proc do
|
31
|
+
track_files 'app/**/*.rb'
|
32
|
+
|
33
|
+
add_filter '/bin/'
|
34
|
+
add_filter '/config/'
|
35
|
+
add_filter '/db/'
|
36
|
+
add_filter '/lib/'
|
37
|
+
add_filter '/test/'
|
38
|
+
add_filter 'vendor'
|
39
|
+
add_filter 'node_modules'
|
40
|
+
add_filter '/Rakefile'
|
41
|
+
add_filter '/app/controllers/admin/'
|
42
|
+
add_filter '/app/presenters/admin/'
|
43
|
+
add_filter '/app/decorators/admin/'
|
44
|
+
add_filter '/app/helpers/admin/'
|
45
|
+
|
46
|
+
add_group 'Services', 'app/services'
|
47
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ParallelCoverage
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
initializer 'parallel_coverage.run', after: :load_config_initializers do
|
6
|
+
ParallelCoverage.run_coverage
|
7
|
+
end
|
8
|
+
|
9
|
+
initializer 'parallel_coverage.report' do
|
10
|
+
ParallelCoverage.parallelize_coverage
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dev-team Codeur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -59,7 +59,12 @@ email:
|
|
59
59
|
executables: []
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
|
-
files:
|
62
|
+
files:
|
63
|
+
- README.md
|
64
|
+
- Rakefile
|
65
|
+
- lib/parallel_coverage.rb
|
66
|
+
- lib/parallel_coverage/engine.rb
|
67
|
+
- lib/parallel_coverage/version.rb
|
63
68
|
homepage: https://github.com/codeur/parallel_coverage
|
64
69
|
licenses:
|
65
70
|
- MIT
|
@@ -80,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
85
|
- !ruby/object:Gem::Version
|
81
86
|
version: '0'
|
82
87
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
88
|
+
rubygems_version: 3.2.7
|
84
89
|
signing_key:
|
85
90
|
specification_version: 4
|
86
91
|
summary: Setup code coverage for parallelized rails tests
|