simplecov-compare 0.2.1 → 0.3.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/CHANGELOG.md +16 -4
- data/README.md +1 -1
- data/bin/simplecov-compare +1 -1
- data/lib/simplecov/compare/file_comparison.rb +1 -1
- data/lib/simplecov/compare/file_line.rb +1 -1
- data/lib/simplecov/compare/file_result.rb +2 -2
- data/lib/simplecov/compare/formatter/markdown_formatter.rb +2 -2
- data/lib/simplecov/compare/reporter/glamour_reporter.rb +1 -1
- data/lib/simplecov/compare/reporter/simple_reporter.rb +1 -1
- data/lib/simplecov/compare/result_file.rb +1 -1
- data/lib/simplecov/compare/result_set.rb +1 -1
- data/lib/simplecov/compare/result_set_comparison.rb +5 -1
- data/lib/simplecov/compare/version.rb +2 -2
- data/lib/simplecov/compare.rb +1 -1
- data/sig/simplecov/compare.rbs +1 -1
- data/test/simplecov/compare/file_comparison_test.rb +1 -1
- data/test/simplecov/compare/file_line_test.rb +1 -1
- data/test/simplecov/compare/file_result_test.rb +1 -1
- data/test/simplecov/compare/formatter/markdown_formatter_test.rb +3 -2
- data/test/simplecov/compare/reporter/simple_reporter_test.rb +1 -1
- data/test/simplecov/compare/result_file_test.rb +1 -1
- data/test/simplecov/compare/result_set_comparison_test.rb +19 -1
- data/test/simplecov/compare/result_set_test.rb +1 -1
- data/test/simplecov/compare_test.rb +14 -15
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5dea173251fa50dbc5c29fd2a6b2f7473f7d61c1379b53c29efaf46d8c4fe433
|
|
4
|
+
data.tar.gz: 890ab6dbdc3ab70ba1c2523addc70218bed3ae63061bc427168454ca123b60e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a6f028853f8d7e6a03072478489d05590c6490f745c1c0ed6c14d7514b98b1b3018c9418517f256cda391ad0fffe633b0ea6c0ce2fe23a43fdcb87ac72052e7
|
|
7
|
+
data.tar.gz: 233b2d494935f2fd1534170913cf4b4a45d24cc1a8d1da992d2a4d86c4a4aaa3693e7eee12ec4cf40ddd43effd0e36c3453b818f7d017aafe086762e541a1068
|
data/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
## Current release (in development)
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.3.0 [2026-02-21]
|
|
4
|
+
|
|
5
|
+
* Update module casing to match SimpleCov project.
|
|
6
|
+
|
|
7
|
+
*Kevin Murphy*
|
|
8
|
+
|
|
9
|
+
## 0.2.2 [2026-02-09]
|
|
10
|
+
|
|
11
|
+
* Expose and display total number of file differences.
|
|
12
|
+
|
|
13
|
+
*Kevin Murphy*
|
|
14
|
+
|
|
15
|
+
## 0.2.1 [2026-02-08]
|
|
4
16
|
|
|
5
17
|
* Increase Glamour line width word wrap.
|
|
6
18
|
|
|
7
19
|
*Kevin Murphy*
|
|
8
20
|
|
|
9
|
-
## 0.2.0 [2026-
|
|
21
|
+
## 0.2.0 [2026-02-08]
|
|
10
22
|
|
|
11
23
|
* Markdown formatter shows the coverage before and after per file.
|
|
12
24
|
|
|
@@ -28,13 +40,13 @@
|
|
|
28
40
|
|
|
29
41
|
*Kevin Murphy*
|
|
30
42
|
|
|
31
|
-
## 0.1.1 [2026-
|
|
43
|
+
## 0.1.1 [2026-02-08]
|
|
32
44
|
|
|
33
45
|
* Add checks that file paths are provided.
|
|
34
46
|
|
|
35
47
|
*Kevin Murphy*
|
|
36
48
|
|
|
37
|
-
## 0.1.0 [2026-
|
|
49
|
+
## 0.1.0 [2026-02-08]
|
|
38
50
|
|
|
39
51
|
* Initial Release.
|
|
40
52
|
|
data/README.md
CHANGED
|
@@ -58,4 +58,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
58
58
|
|
|
59
59
|
## Code of Conduct
|
|
60
60
|
|
|
61
|
-
Everyone interacting in the Simplecov::Compare project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kevin-j-m
|
|
61
|
+
Everyone interacting in the Simplecov::Compare project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kevin-j-m/simplecov-compare/blob/main/CODE_OF_CONDUCT.md).
|
data/bin/simplecov-compare
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module SimpleCov
|
|
4
4
|
module Compare
|
|
5
5
|
class FileResult
|
|
6
6
|
# https://github.com/simplecov-ruby/simplecov/blob/main/lib/simplecov/source_file.rb
|
|
@@ -48,7 +48,7 @@ module Simplecov
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def same_file?(other)
|
|
51
|
-
return false unless other.is_a?(
|
|
51
|
+
return false unless other.is_a?(SimpleCov::Compare::FileResult)
|
|
52
52
|
|
|
53
53
|
filename.to_s.downcase == other.filename.to_s.downcase
|
|
54
54
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module SimpleCov
|
|
4
4
|
module Compare
|
|
5
5
|
module Formatter
|
|
6
6
|
class MarkdownFormatter
|
|
@@ -56,7 +56,7 @@ module Simplecov
|
|
|
56
56
|
def file_differences(result_set_comparison)
|
|
57
57
|
if result_set_comparison.file_differences?
|
|
58
58
|
<<~FILE_DIFF
|
|
59
|
-
## File Differences
|
|
59
|
+
## File Differences (#{result_set_comparison.num_file_differences})
|
|
60
60
|
|
|
61
61
|
| File Name | Delta | From | To |
|
|
62
62
|
| --------- | ----- | ---- | -- |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module SimpleCov
|
|
4
4
|
module Compare
|
|
5
5
|
class ResultSetComparison
|
|
6
6
|
def initialize(base, to:)
|
|
@@ -42,6 +42,10 @@ module Simplecov
|
|
|
42
42
|
!file_differences.empty?
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
def num_file_differences
|
|
46
|
+
file_differences.size
|
|
47
|
+
end
|
|
48
|
+
|
|
45
49
|
private
|
|
46
50
|
|
|
47
51
|
def compare
|
data/lib/simplecov/compare.rb
CHANGED
|
@@ -11,7 +11,7 @@ require_relative "compare/result_file"
|
|
|
11
11
|
require_relative "compare/result_set"
|
|
12
12
|
require_relative "compare/result_set_comparison"
|
|
13
13
|
|
|
14
|
-
module
|
|
14
|
+
module SimpleCov
|
|
15
15
|
module Compare
|
|
16
16
|
class NoPathError < StandardError
|
|
17
17
|
def initialize(msg="Required path not provided")
|
data/sig/simplecov/compare.rbs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "test_helper"
|
|
4
4
|
|
|
5
|
-
module
|
|
5
|
+
module SimpleCov
|
|
6
6
|
module Compare
|
|
7
7
|
module Formatter
|
|
8
8
|
describe MarkdownFormatter do
|
|
@@ -56,6 +56,7 @@ module Simplecov
|
|
|
56
56
|
stubs { big_increase.new_num_relevant_lines }.with { 4 }
|
|
57
57
|
|
|
58
58
|
stubs { comparison.file_differences }.with { [big_increase, small_decrease, big_decrease, small_increase] }
|
|
59
|
+
stubs { comparison.num_file_differences }.with { 4 }
|
|
59
60
|
|
|
60
61
|
markdown_result = <<~MARKDOWN
|
|
61
62
|
# Coverage Comparison
|
|
@@ -64,7 +65,7 @@ module Simplecov
|
|
|
64
65
|
|
|
65
66
|
Coverage increased 9 points from 33% to 42%.
|
|
66
67
|
|
|
67
|
-
## File Differences
|
|
68
|
+
## File Differences (4)
|
|
68
69
|
|
|
69
70
|
| File Name | Delta | From | To |
|
|
70
71
|
| --------- | ----- | ---- | -- |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "test_helper"
|
|
4
4
|
|
|
5
|
-
module
|
|
5
|
+
module SimpleCov
|
|
6
6
|
module Compare
|
|
7
7
|
describe ResultSetComparison do
|
|
8
8
|
describe "#original_lines_covered_percent" do
|
|
@@ -244,6 +244,24 @@ module Simplecov
|
|
|
244
244
|
assert_equal false, comparison.file_differences?
|
|
245
245
|
end
|
|
246
246
|
end
|
|
247
|
+
|
|
248
|
+
describe "#num_file_differences" do
|
|
249
|
+
it "counts the number of differences found" do
|
|
250
|
+
base_file = Mocktail.of(FileResult)
|
|
251
|
+
stubs { base_file.lines_covered_percent }.with { 5 }
|
|
252
|
+
stubs { base_file.filename }.with { "base.rb" }
|
|
253
|
+
|
|
254
|
+
base = Mocktail.of(ResultSet)
|
|
255
|
+
stubs { base.files }.with { [base_file] }
|
|
256
|
+
|
|
257
|
+
other = Mocktail.of(ResultSet)
|
|
258
|
+
stubs { other.files }.with { [] }
|
|
259
|
+
|
|
260
|
+
comparison = ResultSetComparison.new(base, to: other)
|
|
261
|
+
|
|
262
|
+
assert_equal 1, comparison.num_file_differences
|
|
263
|
+
end
|
|
264
|
+
end
|
|
247
265
|
end
|
|
248
266
|
end
|
|
249
267
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "test_helper"
|
|
4
4
|
|
|
5
|
-
describe
|
|
5
|
+
describe SimpleCov::Compare do
|
|
6
6
|
describe ".report" do
|
|
7
7
|
it "outputs the difference in the two files" do
|
|
8
8
|
expected_output = <<~EXPECTED_OUTPUT
|
|
@@ -12,7 +12,7 @@ describe Simplecov::Compare do
|
|
|
12
12
|
|
|
13
13
|
Coverage increased 66.67 points from 0.0% to 66.67%.
|
|
14
14
|
|
|
15
|
-
## File Differences
|
|
15
|
+
## File Differences (3)
|
|
16
16
|
|
|
17
17
|
| File Name | Delta | From | To |
|
|
18
18
|
| --------- | ----- | ---- | -- |
|
|
@@ -24,40 +24,39 @@ describe Simplecov::Compare do
|
|
|
24
24
|
EXPECTED_OUTPUT
|
|
25
25
|
|
|
26
26
|
assert_output(expected_output) do
|
|
27
|
-
|
|
27
|
+
SimpleCov::Compare.report(
|
|
28
28
|
base_path: "test/fixtures/empty_resultset.json",
|
|
29
29
|
to_path: "test/fixtures/sample_resultset.json",
|
|
30
|
-
formatter_class:
|
|
31
|
-
reporter_class:
|
|
30
|
+
formatter_class: SimpleCov::Compare::Formatter::MarkdownFormatter,
|
|
31
|
+
reporter_class: SimpleCov::Compare::Reporter::SimpleReporter,
|
|
32
32
|
)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
it "raises an exception when no base path is provided" do
|
|
37
|
-
assert_raises(
|
|
38
|
-
|
|
37
|
+
assert_raises(SimpleCov::Compare::NoPathError, "Base path not provided") do
|
|
38
|
+
SimpleCov::Compare.report(
|
|
39
39
|
base_path: nil,
|
|
40
40
|
to_path: "test/fixtures/sample_resultset.json",
|
|
41
|
-
formatter_class:
|
|
42
|
-
reporter_class:
|
|
41
|
+
formatter_class: SimpleCov::Compare::Formatter::MarkdownFormatter,
|
|
42
|
+
reporter_class: SimpleCov::Compare::Reporter::SimpleReporter,
|
|
43
43
|
)
|
|
44
44
|
end
|
|
45
|
-
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
it "raises an exception when no to path is provided" do
|
|
49
|
-
assert_raises(
|
|
50
|
-
|
|
48
|
+
assert_raises(SimpleCov::Compare::NoPathError, "To path not provided") do
|
|
49
|
+
SimpleCov::Compare.report(
|
|
51
50
|
base_path: "test/fixtures/sample_resultset.json",
|
|
52
51
|
to_path: nil,
|
|
53
|
-
formatter_class:
|
|
54
|
-
reporter_class:
|
|
52
|
+
formatter_class: SimpleCov::Compare::Formatter::MarkdownFormatter,
|
|
53
|
+
reporter_class: SimpleCov::Compare::Reporter::SimpleReporter,
|
|
55
54
|
)
|
|
56
55
|
end
|
|
57
56
|
end
|
|
58
57
|
end
|
|
59
58
|
|
|
60
59
|
it "has a version number" do
|
|
61
|
-
assert !
|
|
60
|
+
assert !SimpleCov::Compare::VERSION.nil?
|
|
62
61
|
end
|
|
63
62
|
end
|