simplecov-compare 0.1.0 → 0.2.0
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/.github/workflows/test.yml +25 -0
- data/CHANGELOG.md +35 -0
- data/README.md +14 -4
- data/lib/simplecov/compare/file_comparison.rb +37 -1
- data/lib/simplecov/compare/file_result.rb +10 -2
- data/lib/simplecov/compare/formatter/markdown_formatter.rb +6 -3
- data/lib/simplecov/compare/result_set.rb +2 -2
- data/lib/simplecov/compare/result_set_comparison.rb +1 -1
- data/lib/simplecov/compare/version.rb +1 -1
- data/lib/simplecov/compare.rb +9 -0
- data/simplecov-compare-terminal.png +0 -0
- data/test/simplecov/compare/file_comparison_test.rb +102 -0
- data/test/simplecov/compare/file_result_test.rb +18 -0
- data/test/simplecov/compare/formatter/markdown_formatter_test.rb +33 -6
- data/test/simplecov/compare_test.rb +28 -5
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ef291a274c59e3f99f89fe974daf3381494e612ebb413ffb22de5df14b5b281
|
|
4
|
+
data.tar.gz: a59c739a7ed6201beef06f28b21350a182055d6df21c23d1b2e02f2e321749b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52f01295501e38c96606790de5bbc859c2f28e3e1f6ba81f7df61d455e60af2a28898c9c02fbe67cd0cb7ab09cfef1114384a24980a79a300ad5ff0e3a109063
|
|
7
|
+
data.tar.gz: c0fb9433dff8ac96c9862de9a6ef8636f63fc2f20dc2e1d092b229b8ed207126d338e46f631c3c66e5c9225e22cf293558acdd497e6cea01c140a543b6bcaa38
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
tests:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
ruby: [3.4, 4.0]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
|
+
- name: Set up Ruby
|
|
18
|
+
uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
bundler-cache: true
|
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
|
22
|
+
- name: Setup
|
|
23
|
+
run: ./bin/setup
|
|
24
|
+
- name: Run tests
|
|
25
|
+
run: bundle exec rake test
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
## Current release (in development)
|
|
2
|
+
|
|
3
|
+
## 0.2.0 [2026-03-08]
|
|
4
|
+
|
|
5
|
+
* Markdown formatter shows the coverage before and after per file.
|
|
6
|
+
|
|
7
|
+
*Kevin Murphy*
|
|
8
|
+
|
|
9
|
+
* Expose the number of relevant and covered lines per file.
|
|
10
|
+
|
|
11
|
+
*Kevin Murphy*
|
|
12
|
+
|
|
13
|
+
* Add instructions about running on command line.
|
|
14
|
+
|
|
15
|
+
*Kevin Murphy*
|
|
16
|
+
|
|
17
|
+
* Test against Ruby 3.4 and 4.0.
|
|
18
|
+
|
|
19
|
+
*Kevin Murphy*
|
|
20
|
+
|
|
21
|
+
* Run tests in GitHub actions.
|
|
22
|
+
|
|
23
|
+
*Kevin Murphy*
|
|
24
|
+
|
|
25
|
+
## 0.1.1 [2026-03-08]
|
|
26
|
+
|
|
27
|
+
* Add checks that file paths are provided.
|
|
28
|
+
|
|
29
|
+
*Kevin Murphy*
|
|
30
|
+
|
|
31
|
+
## 0.1.0 [2026-03-08]
|
|
32
|
+
|
|
33
|
+
* Initial Release.
|
|
34
|
+
|
|
35
|
+
*Kevin Murphy*
|
data/README.md
CHANGED
|
@@ -6,22 +6,32 @@ mechanism to compare two Simplecov results.
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
|
10
|
-
|
|
11
9
|
Install the gem and add to the application's Gemfile by executing:
|
|
12
10
|
|
|
13
11
|
```bash
|
|
14
|
-
bundle add
|
|
12
|
+
bundle add simplecov-compare
|
|
15
13
|
```
|
|
16
14
|
|
|
17
15
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
|
-
gem install
|
|
18
|
+
gem install simplecov-compare
|
|
21
19
|
```
|
|
22
20
|
|
|
23
21
|
## Usage
|
|
24
22
|
|
|
23
|
+
### Command Line
|
|
24
|
+
|
|
25
|
+
Given an earlier coverage JSON output named `path/to/before.json` and a later
|
|
26
|
+
report named `path/to/after.json`, you can run:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
simplecov-compare path/to/before.json path/to/after.json
|
|
30
|
+
```
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
### In Ruby
|
|
34
|
+
|
|
25
35
|
Given an earlier coverage JSON output named `path/to/before.json` and a later
|
|
26
36
|
report named `path/to/after.json`, you can run:
|
|
27
37
|
|
|
@@ -38,7 +38,43 @@ module Simplecov
|
|
|
38
38
|
return @other.lines_covered_percent if @base.nil?
|
|
39
39
|
return (-@base.lines_covered_percent) if @other.nil?
|
|
40
40
|
|
|
41
|
-
@other.lines_covered_percent - @base.lines_covered_percent
|
|
41
|
+
(@other.lines_covered_percent - @base.lines_covered_percent).round(2)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def original_lines_covered_percent
|
|
45
|
+
return 0 if @base.nil?
|
|
46
|
+
|
|
47
|
+
@base.lines_covered_percent
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def original_num_relevant_lines
|
|
51
|
+
return 0 if @base.nil?
|
|
52
|
+
|
|
53
|
+
@base.num_relevant_lines
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def original_num_covered_lines
|
|
57
|
+
return 0 if @base.nil?
|
|
58
|
+
|
|
59
|
+
@base.num_covered_lines
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def new_lines_covered_percent
|
|
63
|
+
return 0 if @other.nil?
|
|
64
|
+
|
|
65
|
+
@other.lines_covered_percent
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def new_num_relevant_lines
|
|
69
|
+
return 0 if @other.nil?
|
|
70
|
+
|
|
71
|
+
@other.num_relevant_lines
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def new_num_covered_lines
|
|
75
|
+
return 0 if @other.nil?
|
|
76
|
+
|
|
77
|
+
@other.num_covered_lines
|
|
42
78
|
end
|
|
43
79
|
end
|
|
44
80
|
end
|
|
@@ -29,14 +29,22 @@ module Simplecov
|
|
|
29
29
|
lines.select { _1.relevant? }
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
def num_relevant_lines
|
|
33
|
+
relevant_lines.size
|
|
34
|
+
end
|
|
35
|
+
|
|
32
36
|
def covered_lines
|
|
33
37
|
lines.select { _1.covered? }
|
|
34
38
|
end
|
|
35
39
|
|
|
40
|
+
def num_covered_lines
|
|
41
|
+
covered_lines.size
|
|
42
|
+
end
|
|
43
|
+
|
|
36
44
|
def lines_covered_percent
|
|
37
|
-
return 100 if
|
|
45
|
+
return 100 if num_relevant_lines.zero?
|
|
38
46
|
|
|
39
|
-
((
|
|
47
|
+
((num_covered_lines / num_relevant_lines.to_f) * 100).round(2)
|
|
40
48
|
end
|
|
41
49
|
|
|
42
50
|
def same_file?(other)
|
|
@@ -58,8 +58,8 @@ module Simplecov
|
|
|
58
58
|
<<~FILE_DIFF
|
|
59
59
|
## File Differences
|
|
60
60
|
|
|
61
|
-
| File Name |
|
|
62
|
-
| --------- |
|
|
61
|
+
| File Name | Delta | From | To |
|
|
62
|
+
| --------- | ----- | ---- | -- |
|
|
63
63
|
#{file_differences_table_contents(result_set_comparison)}
|
|
64
64
|
FILE_DIFF
|
|
65
65
|
else
|
|
@@ -76,7 +76,10 @@ module Simplecov
|
|
|
76
76
|
.file_differences
|
|
77
77
|
.sort_by { _1.lines_coverage_delta_points }
|
|
78
78
|
.each_with_object(+"") do |file_difference, output|
|
|
79
|
-
output << "| #{file_difference.filename}
|
|
79
|
+
output << "| #{file_difference.filename} "\
|
|
80
|
+
"| #{file_difference.lines_coverage_delta_points} "\
|
|
81
|
+
"| #{file_difference.original_lines_covered_percent}% (#{file_difference.original_num_covered_lines}/#{file_difference.original_num_relevant_lines}) "\
|
|
82
|
+
"| #{file_difference.new_lines_covered_percent}% (#{file_difference.new_num_covered_lines}/#{file_difference.new_num_relevant_lines}) |\n"
|
|
80
83
|
end
|
|
81
84
|
end
|
|
82
85
|
end
|
|
@@ -20,11 +20,11 @@ module Simplecov
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def num_relevant_lines
|
|
23
|
-
files.sum { _1.
|
|
23
|
+
files.sum { _1.num_relevant_lines }
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def num_covered_lines
|
|
27
|
-
files.sum { _1.
|
|
27
|
+
files.sum { _1.num_covered_lines }
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def lines_covered_percent
|
|
@@ -28,7 +28,7 @@ module Simplecov
|
|
|
28
28
|
return new_lines_covered_percent if @base.nil?
|
|
29
29
|
return -original_lines_covered_percent if @other.nil?
|
|
30
30
|
|
|
31
|
-
new_lines_covered_percent - original_lines_covered_percent
|
|
31
|
+
(new_lines_covered_percent - original_lines_covered_percent).round(2)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def file_differences
|
data/lib/simplecov/compare.rb
CHANGED
|
@@ -13,7 +13,16 @@ require_relative "compare/result_set_comparison"
|
|
|
13
13
|
|
|
14
14
|
module Simplecov
|
|
15
15
|
module Compare
|
|
16
|
+
class NoPathError < StandardError
|
|
17
|
+
def initialize(msg="Required path not provided")
|
|
18
|
+
super
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
16
22
|
def self.report(base_path:, to_path:, formatter_class: Formatter::MarkdownFormatter, reporter_class: Reporter::GlamourReporter)
|
|
23
|
+
raise NoPathError, "Base path not provided" if base_path.nil?
|
|
24
|
+
raise NoPathError, "To path not provided" if to_path.nil?
|
|
25
|
+
|
|
17
26
|
base = ResultSet.new(ResultFile.new(base_path).coverage_data)
|
|
18
27
|
other = ResultSet.new(ResultFile.new(to_path).coverage_data)
|
|
19
28
|
comparison = ResultSetComparison.new(base, to: other)
|
|
Binary file
|
|
@@ -229,6 +229,108 @@ module Simplecov
|
|
|
229
229
|
assert_equal(-50, comparison.lines_coverage_delta_points)
|
|
230
230
|
end
|
|
231
231
|
end
|
|
232
|
+
|
|
233
|
+
describe "#original_lines_covered_percent" do
|
|
234
|
+
it "is the lines coverage of the base file" do
|
|
235
|
+
base = Mocktail.of(FileResult)
|
|
236
|
+
stubs { base.lines_covered_percent }.with { 50 }
|
|
237
|
+
|
|
238
|
+
comparison = FileComparison.new(base, to: nil)
|
|
239
|
+
|
|
240
|
+
assert_equal 50, comparison.original_lines_covered_percent
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
it "is 0 with no base file" do
|
|
244
|
+
comparison = FileComparison.new(nil, to: nil)
|
|
245
|
+
|
|
246
|
+
assert_equal 0, comparison.original_lines_covered_percent
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
describe "#new_lines_covered_percent" do
|
|
251
|
+
it "is the lines coverage of the comparison file" do
|
|
252
|
+
other = Mocktail.of(FileResult)
|
|
253
|
+
stubs { other.lines_covered_percent }.with { 75 }
|
|
254
|
+
|
|
255
|
+
comparison = FileComparison.new(nil, to: other)
|
|
256
|
+
|
|
257
|
+
assert_equal 75, comparison.new_lines_covered_percent
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
it "is 0 with no comparison file" do
|
|
261
|
+
comparison = FileComparison.new(nil, to: nil)
|
|
262
|
+
|
|
263
|
+
assert_equal 0, comparison.new_lines_covered_percent
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
describe "#original_num_relevant_lines" do
|
|
268
|
+
it "is the number of relevant lines of the base file" do
|
|
269
|
+
base = Mocktail.of(FileResult)
|
|
270
|
+
stubs { base.num_relevant_lines }.with { 33 }
|
|
271
|
+
|
|
272
|
+
comparison = FileComparison.new(base, to: nil)
|
|
273
|
+
|
|
274
|
+
assert_equal 33, comparison.original_num_relevant_lines
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
it "is 0 with no base file" do
|
|
278
|
+
comparison = FileComparison.new(nil, to: nil)
|
|
279
|
+
|
|
280
|
+
assert_equal 0, comparison.original_num_relevant_lines
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
describe "#original_num_covered_lines" do
|
|
285
|
+
it "is the number of covered lines of the base file" do
|
|
286
|
+
base = Mocktail.of(FileResult)
|
|
287
|
+
stubs { base.num_covered_lines }.with { 17 }
|
|
288
|
+
|
|
289
|
+
comparison = FileComparison.new(base, to: nil)
|
|
290
|
+
|
|
291
|
+
assert_equal 17, comparison.original_num_covered_lines
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
it "is 0 with no base file" do
|
|
295
|
+
comparison = FileComparison.new(nil, to: nil)
|
|
296
|
+
|
|
297
|
+
assert_equal 0, comparison.original_num_covered_lines
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
describe "#new_num_relevant_lines" do
|
|
302
|
+
it "is the number of relevant lines of the comparison file" do
|
|
303
|
+
other = Mocktail.of(FileResult)
|
|
304
|
+
stubs { other.num_relevant_lines }.with { 42 }
|
|
305
|
+
|
|
306
|
+
comparison = FileComparison.new(nil, to: other)
|
|
307
|
+
|
|
308
|
+
assert_equal 42, comparison.new_num_relevant_lines
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
it "is 0 with no comparison file" do
|
|
312
|
+
comparison = FileComparison.new(nil, to: nil)
|
|
313
|
+
|
|
314
|
+
assert_equal 0, comparison.new_num_relevant_lines
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
describe "#new_num_covered_lines" do
|
|
319
|
+
it "is the number of covered lines of the comparison file" do
|
|
320
|
+
other = Mocktail.of(FileResult)
|
|
321
|
+
stubs { other.num_covered_lines }.with { 71 }
|
|
322
|
+
|
|
323
|
+
comparison = FileComparison.new(nil, to: other)
|
|
324
|
+
|
|
325
|
+
assert_equal 71, comparison.new_num_covered_lines
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
it "is 0 with no comparison file" do
|
|
329
|
+
comparison = FileComparison.new(nil, to: nil)
|
|
330
|
+
|
|
331
|
+
assert_equal 0, comparison.new_num_covered_lines
|
|
332
|
+
end
|
|
333
|
+
end
|
|
232
334
|
end
|
|
233
335
|
end
|
|
234
336
|
end
|
|
@@ -38,6 +38,15 @@ module Simplecov
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
describe "#num_relevant_lines" do
|
|
42
|
+
it "provides the line count with relevant coverage information" do
|
|
43
|
+
coverage_data = { "lines" => [0, 1, nil, 47] }
|
|
44
|
+
file = FileResult.new(nil, coverage_data:)
|
|
45
|
+
|
|
46
|
+
assert_equal 3, file.num_relevant_lines
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
41
50
|
describe "#covered_lines" do
|
|
42
51
|
it "provides the lines that have been covered in the coverage report" do
|
|
43
52
|
coverage_data = { "lines" => [0, 1, nil, 47] }
|
|
@@ -47,6 +56,15 @@ module Simplecov
|
|
|
47
56
|
end
|
|
48
57
|
end
|
|
49
58
|
|
|
59
|
+
describe "#num_covered_lines" do
|
|
60
|
+
it "provides the line count that have been covered in the coverage report" do
|
|
61
|
+
coverage_data = { "lines" => [0, 1, nil, 47] }
|
|
62
|
+
file = FileResult.new(nil, coverage_data:)
|
|
63
|
+
|
|
64
|
+
assert_equal 2, file.num_covered_lines
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
50
68
|
describe "#lines_covered_percent" do
|
|
51
69
|
it "is the percentage of relevant lines in the file that have been covered" do
|
|
52
70
|
coverage_data = { "lines" => [0, 1, nil, 47] }
|
|
@@ -18,15 +18,42 @@ module Simplecov
|
|
|
18
18
|
big_decrease = Mocktail.of(FileComparison)
|
|
19
19
|
stubs { big_decrease.filename }.with { "big_decrease.rb" }
|
|
20
20
|
stubs { big_decrease.lines_coverage_delta_points }.with { -20 }
|
|
21
|
+
stubs { big_decrease.original_lines_covered_percent }.with { 50 }
|
|
22
|
+
stubs { big_decrease.original_num_covered_lines }.with { 5 }
|
|
23
|
+
stubs { big_decrease.original_num_relevant_lines }.with { 10 }
|
|
24
|
+
stubs { big_decrease.new_lines_covered_percent }.with { 30 }
|
|
25
|
+
stubs { big_decrease.new_num_covered_lines }.with { 3 }
|
|
26
|
+
stubs { big_decrease.new_num_relevant_lines }.with { 10 }
|
|
27
|
+
|
|
21
28
|
small_decrease = Mocktail.of(FileComparison)
|
|
22
29
|
stubs { small_decrease.filename }.with { "small_decrease.rb" }
|
|
23
30
|
stubs { small_decrease.lines_coverage_delta_points }.with { -3 }
|
|
31
|
+
stubs { small_decrease.original_lines_covered_percent }.with { 53 }
|
|
32
|
+
stubs { small_decrease.original_num_covered_lines }.with { 53 }
|
|
33
|
+
stubs { small_decrease.original_num_relevant_lines }.with { 100 }
|
|
34
|
+
stubs { small_decrease.new_lines_covered_percent }.with { 50 }
|
|
35
|
+
stubs { small_decrease.new_num_covered_lines }.with { 50 }
|
|
36
|
+
stubs { small_decrease.new_num_relevant_lines }.with { 100 }
|
|
37
|
+
|
|
24
38
|
small_increase = Mocktail.of(FileComparison)
|
|
25
39
|
stubs { small_increase.filename }.with { "small_increase.rb" }
|
|
26
40
|
stubs { small_increase.lines_coverage_delta_points }.with { 7 }
|
|
41
|
+
stubs { small_increase.original_lines_covered_percent }.with { 0 }
|
|
42
|
+
stubs { small_increase.original_num_covered_lines }.with { 0 }
|
|
43
|
+
stubs { small_increase.original_num_relevant_lines }.with { 100 }
|
|
44
|
+
stubs { small_increase.new_lines_covered_percent }.with { 7 }
|
|
45
|
+
stubs { small_increase.new_num_covered_lines }.with { 7 }
|
|
46
|
+
stubs { small_increase.new_num_relevant_lines }.with { 100 }
|
|
47
|
+
|
|
27
48
|
big_increase = Mocktail.of(FileComparison)
|
|
28
49
|
stubs { big_increase.filename }.with { "big_increase.rb" }
|
|
29
50
|
stubs { big_increase.lines_coverage_delta_points }.with { 25 }
|
|
51
|
+
stubs { big_increase.original_lines_covered_percent }.with { 25 }
|
|
52
|
+
stubs { big_increase.original_num_covered_lines }.with { 1 }
|
|
53
|
+
stubs { big_increase.original_num_relevant_lines }.with { 4 }
|
|
54
|
+
stubs { big_increase.new_lines_covered_percent }.with { 50 }
|
|
55
|
+
stubs { big_increase.new_num_covered_lines }.with { 2 }
|
|
56
|
+
stubs { big_increase.new_num_relevant_lines }.with { 4 }
|
|
30
57
|
|
|
31
58
|
stubs { comparison.file_differences }.with { [big_increase, small_decrease, big_decrease, small_increase] }
|
|
32
59
|
|
|
@@ -39,12 +66,12 @@ module Simplecov
|
|
|
39
66
|
|
|
40
67
|
## File Differences
|
|
41
68
|
|
|
42
|
-
| File Name |
|
|
43
|
-
| --------- |
|
|
44
|
-
| big_decrease.rb | -20 |
|
|
45
|
-
| small_decrease.rb | -3 |
|
|
46
|
-
| small_increase.rb | 7 |
|
|
47
|
-
| big_increase.rb | 25 |
|
|
69
|
+
| File Name | Delta | From | To |
|
|
70
|
+
| --------- | ----- | ---- | -- |
|
|
71
|
+
| big_decrease.rb | -20 | 50% (5/10) | 30% (3/10) |
|
|
72
|
+
| small_decrease.rb | -3 | 53% (53/100) | 50% (50/100) |
|
|
73
|
+
| small_increase.rb | 7 | 0% (0/100) | 7% (7/100) |
|
|
74
|
+
| big_increase.rb | 25 | 25% (1/4) | 50% (2/4) |
|
|
48
75
|
|
|
49
76
|
|
|
50
77
|
MARKDOWN
|
|
@@ -14,11 +14,11 @@ describe Simplecov::Compare do
|
|
|
14
14
|
|
|
15
15
|
## File Differences
|
|
16
16
|
|
|
17
|
-
| File Name |
|
|
18
|
-
| --------- |
|
|
19
|
-
| /path/to/app/models/other_model.rb | 50.0 |
|
|
20
|
-
| /path/to/app/models/model_name.rb | 81.82 |
|
|
21
|
-
| /path/to/app/helpers/application_helper.rb | 100.0 |
|
|
17
|
+
| File Name | Delta | From | To |
|
|
18
|
+
| --------- | ----- | ---- | -- |
|
|
19
|
+
| /path/to/app/models/other_model.rb | 50.0 | 0% (0/0) | 50.0% (6/12) |
|
|
20
|
+
| /path/to/app/models/model_name.rb | 81.82 | 0% (0/0) | 81.82% (9/11) |
|
|
21
|
+
| /path/to/app/helpers/application_helper.rb | 100.0 | 0.0% (0/1) | 100.0% (1/1) |
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
EXPECTED_OUTPUT
|
|
@@ -32,6 +32,29 @@ describe Simplecov::Compare do
|
|
|
32
32
|
)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
+
|
|
36
|
+
it "raises an exception when no base path is provided" do
|
|
37
|
+
assert_raises(Simplecov::Compare::NoPathError, "Base path not provided") do
|
|
38
|
+
Simplecov::Compare.report(
|
|
39
|
+
base_path: nil,
|
|
40
|
+
to_path: "test/fixtures/sample_resultset.json",
|
|
41
|
+
formatter_class: Simplecov::Compare::Formatter::MarkdownFormatter,
|
|
42
|
+
reporter_class: Simplecov::Compare::Reporter::SimpleReporter,
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "raises an exception when no to path is provided" do
|
|
49
|
+
assert_raises(Simplecov::Compare::NoPathError, "To path not provided") do
|
|
50
|
+
Simplecov::Compare.report(
|
|
51
|
+
base_path: "test/fixtures/sample_resultset.json",
|
|
52
|
+
to_path: nil,
|
|
53
|
+
formatter_class: Simplecov::Compare::Formatter::MarkdownFormatter,
|
|
54
|
+
reporter_class: Simplecov::Compare::Reporter::SimpleReporter,
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
35
58
|
end
|
|
36
59
|
|
|
37
60
|
it "has a version number" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simplecov-compare
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kevin Murphy
|
|
@@ -31,6 +31,8 @@ executables:
|
|
|
31
31
|
extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
|
33
33
|
files:
|
|
34
|
+
- ".github/workflows/test.yml"
|
|
35
|
+
- CHANGELOG.md
|
|
34
36
|
- CODE_OF_CONDUCT.md
|
|
35
37
|
- LICENSE.txt
|
|
36
38
|
- README.md
|
|
@@ -48,6 +50,7 @@ files:
|
|
|
48
50
|
- lib/simplecov/compare/result_set_comparison.rb
|
|
49
51
|
- lib/simplecov/compare/version.rb
|
|
50
52
|
- sig/simplecov/compare.rbs
|
|
53
|
+
- simplecov-compare-terminal.png
|
|
51
54
|
- test/fixtures/empty_resultset.json
|
|
52
55
|
- test/fixtures/sample_resultset.json
|
|
53
56
|
- test/simplecov/compare/file_comparison_test.rb
|