|
7 | 7 | # for this to be valuable so that only changed files have tests run |
8 | 8 | if ENV.fetch("COVERAGE", 0).to_i.positive? |
9 | 9 | require "simplecov" |
10 | | - require "simplecov-lcov" |
| 10 | + require "undercover/simplecov_formatter" |
11 | 11 |
|
12 | 12 | # This allows both LCOV and HTML formatting - |
13 | 13 | # lcov for undercover gem, HTML for humans |
14 | | - class SimpleCov::Formatter::MergedFormatter |
15 | | - def format(result) |
16 | | - SimpleCov::Formatter::HTMLFormatter.new.format(result) |
17 | | - SimpleCov::Formatter::LcovFormatter.new.format(result) |
18 | | - end |
19 | | - end |
20 | | - |
21 | | - SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true |
22 | | - SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter |
| 14 | + SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new( |
| 15 | + [ |
| 16 | + SimpleCov::Formatter::Undercover, |
| 17 | + SimpleCov::Formatter::HTMLFormatter, |
| 18 | + ], |
| 19 | + ) |
23 | 20 |
|
24 | 21 | SimpleCov.start :rails do |
25 | 22 | enable_coverage :branch |
26 | | - primary_coverage :branch |
27 | 23 |
|
28 | 24 | # This line would enable coverage for view templates, but the slim compiler |
29 | 25 | # appears to have a bug which puts the whole coverage data out by one line. |
@@ -67,9 +63,9 @@ if ENV.fetch("COVERAGE", 0).to_i.positive? |
67 | 63 | # However (possibly due to some residual random behaviour in test factories) |
68 | 64 | # the line coverage needs to be set 0.02 below the reported value. |
69 | 65 | # Nornmally this value needs to be 0.01 below the reported value due to rounding issues. |
70 | | - minimum_coverage line: 97.40, branch: 87.23 |
71 | | - # Values from test run Fri 13th February 2026 |
72 | | - # 97.46% (12553 / 12880) -> 327 lines uncovered |
73 | | - # 87.18% (2808 / 3221) -> 192 + 221 = 411 branches uncovered |
| 66 | + minimum_coverage line: 97.22, branch: 87.23 |
| 67 | + # Values from test run Wed 4th March 2026 |
| 68 | + # 97.43% (12677 / 13011) -> 334 lines uncovered |
| 69 | + # 87.19% (2812 / 3225) -> 188 + 225 = 413 branches uncovered |
74 | 70 | end |
75 | 71 | end |
0 commit comments