|
1 | | -require 'simplecov' |
2 | | -require 'simplecov-lcov' |
| 1 | +require 'simplecov' if ENV['COVERAGE'] == 'true' |
| 2 | +require 'simplecov-lcov' if ENV['COVERAGE'] == 'true' |
3 | 3 | require 'shoulda/matchers' |
4 | 4 | require 'webmock/rspec' |
5 | 5 |
|
6 | | -# Fix incompatibility of simplecov-lcov with older versions of simplecov that are not expresses in its gemspec. |
7 | | -# https://github.com/fortissimo1997/simplecov-lcov/pull/25 |
| 6 | +if ENV['COVERAGE'] == 'true' |
| 7 | + # Fix incompatibility of simplecov-lcov with older versions of simplecov that are not expresses in its gemspec. |
| 8 | + # https://github.com/fortissimo1997/simplecov-lcov/pull/25 |
8 | 9 |
|
9 | | -if !SimpleCov.respond_to?(:branch_coverage) |
10 | | - module SimpleCov |
11 | | - def self.branch_coverage? |
12 | | - false |
| 10 | + if !SimpleCov.respond_to?(:branch_coverage) |
| 11 | + module SimpleCov |
| 12 | + def self.branch_coverage? |
| 13 | + false |
| 14 | + end |
13 | 15 | end |
14 | 16 | end |
15 | | -end |
16 | 17 |
|
17 | | -SimpleCov::Formatter::LcovFormatter.config do |c| |
18 | | - c.report_with_single_file = true |
19 | | - c.single_report_path = 'coverage/lcov.info' |
20 | | -end |
| 18 | + SimpleCov::Formatter::LcovFormatter.config do |c| |
| 19 | + c.report_with_single_file = true |
| 20 | + c.single_report_path = 'coverage/lcov.info' |
| 21 | + end |
21 | 22 |
|
22 | | -SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new( |
23 | | - [ |
24 | | - SimpleCov::Formatter::HTMLFormatter, |
25 | | - SimpleCov::Formatter::LcovFormatter, |
26 | | - ] |
27 | | -) |
28 | | - |
29 | | -SimpleCov.start do |
30 | | - add_filter 'spec/' |
31 | | - |
32 | | - # Support parallel test execution |
33 | | - # In CI: Use CI_NODE_INDEX (0, 1, 2, 3) set by GitHub Actions matrix |
34 | | - # Locally: Use TEST_ENV_NUMBER ('', '2', '3', '4') set by parallel_tests |
35 | | - if ENV['CI_NODE_INDEX'] |
36 | | - command_name "RSpec-#{ENV['CI_NODE_INDEX']}" |
37 | | - use_merging true |
38 | | - merge_timeout 3600 |
39 | | - elsif ENV.key?('TEST_ENV_NUMBER') |
40 | | - # TEST_ENV_NUMBER is '' for first process, '2', '3', etc. for others |
41 | | - suffix = ENV['TEST_ENV_NUMBER'].empty? ? '1' : ENV['TEST_ENV_NUMBER'] |
42 | | - command_name "RSpec-#{suffix}" |
43 | | - use_merging true |
44 | | - merge_timeout 3600 |
| 23 | + SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new( |
| 24 | + [ |
| 25 | + SimpleCov::Formatter::HTMLFormatter, |
| 26 | + SimpleCov::Formatter::LcovFormatter, |
| 27 | + ] |
| 28 | + ) |
| 29 | + |
| 30 | + SimpleCov.start do |
| 31 | + add_filter 'spec/' |
| 32 | + |
| 33 | + # Support parallel test execution |
| 34 | + # In CI: Use CI_NODE_INDEX (0, 1, 2, 3) set by GitHub Actions matrix |
| 35 | + # Locally: Use TEST_ENV_NUMBER ('', '2', '3', '4') set by parallel_tests |
| 36 | + if ENV['CI_NODE_INDEX'] |
| 37 | + command_name "RSpec-#{ENV['CI_NODE_INDEX']}" |
| 38 | + use_merging true |
| 39 | + merge_timeout 3600 |
| 40 | + elsif ENV.key?('TEST_ENV_NUMBER') |
| 41 | + # TEST_ENV_NUMBER is '' for first process, '2', '3', etc. for others |
| 42 | + suffix = ENV['TEST_ENV_NUMBER'].empty? ? '1' : ENV['TEST_ENV_NUMBER'] |
| 43 | + command_name "RSpec-#{suffix}" |
| 44 | + use_merging true |
| 45 | + merge_timeout 3600 |
| 46 | + end |
45 | 47 | end |
46 | 48 | end |
47 | 49 |
|
|
0 commit comments