simplecov-cobertura 2.1.0 → 3.0.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/build.yml +2 -2
- data/.gitignore +1 -0
- data/README.md +5 -7
- data/lib/simplecov-cobertura/version.rb +1 -1
- data/lib/simplecov-cobertura.rb +11 -15
- data/simplecov-cobertura.gemspec +2 -2
- data/test/simplecov-cobertura_test.rb +14 -10
- metadata +5 -10
- data/test/coverage/coverage.xml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f4e823da3eaf503a2ba1f94202b474e87e1461864d60df99fbef33f55b877d2
|
4
|
+
data.tar.gz: 21969345160bc14566b87f3d457f89bb0b27b9f9cc4607cd5a1b7bd658d7b176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b857a2943394c10dfe3afaf3cfc2bc9c9e809e7aec136503e9ec75f8815008c9f519e7bd6b7f34901905ce92c35bc1b953ca601f74392ff1941fa3b983c5e833
|
7
|
+
data.tar.gz: 278a3e88e3429d000688a334dc83202af4d084601ceee911d3a8a4e17e1a53ae4eab370b39f2722ffdb28947e2f01bb7e4724adf0ee7c2cb98949b2770c4f12f
|
data/.github/workflows/build.yml
CHANGED
@@ -15,7 +15,7 @@ jobs:
|
|
15
15
|
runs-on: ubuntu-latest
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
|
-
ruby-version: [2.5, 2.6, 2.7, 3.0]
|
18
|
+
ruby-version: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, 3.4]
|
19
19
|
|
20
20
|
steps:
|
21
21
|
- uses: actions/checkout@v2
|
@@ -25,4 +25,4 @@ jobs:
|
|
25
25
|
ruby-version: ${{ matrix.ruby-version }}
|
26
26
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
27
27
|
- name: Run tests
|
28
|
-
run: bundle exec rake
|
28
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# simplecov-cobertura
|
2
|
-
[](https://github.com/jessebs/simplecov-cobertura/actions/workflows/build.yml) [](http://badge.fury.io/rb/simplecov-cobertura)
|
3
3
|
|
4
4
|
|
5
5
|
Produces [Cobertura](http://cobertura.sourceforge.net/) formatted XML from [SimpleCov](https://github.com/colszowka/simplecov).
|
@@ -33,21 +33,19 @@ SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
|
33
33
|
|
34
34
|
## Continuous Integration
|
35
35
|
Tested in a CI environment against the following Ruby versions:
|
36
|
-
* 3.0
|
37
|
-
* 2.7
|
38
|
-
* 2.6
|
39
|
-
* 2.5
|
36
|
+
* 3.0 - 3.4
|
37
|
+
* 2.5 - 2.7
|
40
38
|
|
41
39
|
## Contributing
|
42
40
|
|
43
|
-
1. Fork it ( https://github.com/
|
41
|
+
1. Fork it ( https://github.com/jessebs/simplecov-cobertura/fork )
|
44
42
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
43
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
44
|
4. Push to the branch (`git push origin my-new-feature`)
|
47
45
|
5. Create a new Pull Request
|
48
46
|
|
49
47
|
## License
|
50
|
-
Copyright
|
48
|
+
Copyright 2025 Jesse Bowes
|
51
49
|
|
52
50
|
Licensed under the Apache License, Version 2.0 (the "License");
|
53
51
|
you may not use this file except in compliance with the License.
|
data/lib/simplecov-cobertura.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
|
3
1
|
require 'rexml/document'
|
4
2
|
require 'rexml/element'
|
5
3
|
require 'pathname'
|
@@ -27,7 +25,8 @@ module SimpleCov
|
|
27
25
|
|
28
26
|
xml_str = string_io.string
|
29
27
|
File.write(result_path, xml_str)
|
30
|
-
puts
|
28
|
+
puts output_message(result, result_path)
|
29
|
+
|
31
30
|
xml_str
|
32
31
|
end
|
33
32
|
|
@@ -117,7 +116,7 @@ module SimpleCov
|
|
117
116
|
bs = file.coverage_statistics[:branch]
|
118
117
|
|
119
118
|
filename = file.filename
|
120
|
-
class_.attributes['name'] =
|
119
|
+
class_.attributes['name'] = resolve_filename(filename)
|
121
120
|
class_.attributes['filename'] = resolve_filename(filename)
|
122
121
|
class_.attributes['line-rate'] = extract_rate(ls.percent)
|
123
122
|
if SimpleCov.branch_coverage?
|
@@ -144,20 +143,17 @@ module SimpleCov
|
|
144
143
|
def set_xml_head(lines=[])
|
145
144
|
lines << "<?xml version=\"1.0\"?>"
|
146
145
|
lines << "<!DOCTYPE coverage SYSTEM \"#{DTD_URL}\">"
|
147
|
-
lines << "<!-- Generated by simplecov-cobertura version #{VERSION} (https://github.com/
|
146
|
+
lines << "<!-- Generated by simplecov-cobertura version #{VERSION} (https://github.com/jessebs/simplecov-cobertura) -->"
|
148
147
|
lines.join("\n")
|
149
148
|
end
|
150
149
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
"%d / %d LOC (%.2f%%) covered" % [ls.covered, ls.total, ls.percent]
|
159
|
-
end
|
160
|
-
end
|
150
|
+
# Roughly mirrors private method SimpleCov::Formatter::HTMLFormatter#output_coverage
|
151
|
+
def output_message(result, output_path)
|
152
|
+
output = "Coverage report generated for #{result.command_name} to #{output_path}."
|
153
|
+
output += "\nLine Coverage: #{result.covered_percent.round(2)}% (#{result.covered_lines} / #{result.total_lines})"
|
154
|
+
output += "\nBranch Coverage: #{result.coverage_statistics[:branch].percent.round(2)}% (#{result.covered_branches} / #{result.total_branches})" if SimpleCov.branch_coverage?
|
155
|
+
output
|
156
|
+
end
|
161
157
|
|
162
158
|
def resolve_filename(filename)
|
163
159
|
Pathname.new(filename).relative_path_from(project_root).to_s
|
data/simplecov-cobertura.gemspec
CHANGED
@@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'simplecov-cobertura'
|
9
9
|
spec.version = SimpleCov::Formatter::CoberturaFormatter::VERSION
|
10
10
|
spec.authors = ['Jesse Bowes']
|
11
|
-
spec.email = ['
|
11
|
+
spec.email = ['jessebowes@acm.org']
|
12
12
|
spec.summary = 'SimpleCov Cobertura Formatter'
|
13
13
|
spec.description = 'Produces Cobertura XML formatted output from SimpleCov'
|
14
|
-
spec.homepage = 'https://github.com/
|
14
|
+
spec.homepage = 'https://github.com/jessebs/simplecov-cobertura'
|
15
15
|
spec.license = 'Apache-2.0'
|
16
16
|
spec.required_ruby_version = '>= 2.5.0'
|
17
17
|
|
@@ -45,16 +45,20 @@ class CoberturaFormatterTest < Test::Unit::TestCase
|
|
45
45
|
def test_terminal_output
|
46
46
|
output, _ = capture_output { @formatter.format(@result) }
|
47
47
|
result_path = File.join(SimpleCov.coverage_path, SimpleCov::Formatter::CoberturaFormatter::RESULT_FILE_NAME)
|
48
|
-
output_regex = /Coverage report generated for #{@result.command_name} to #{result_path}
|
48
|
+
output_regex = /Coverage report generated for #{@result.command_name} to #{result_path}.\nLine Coverage: (.*)\nBranch Coverage: (.*)/
|
49
49
|
assert_match(output_regex, output)
|
50
50
|
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
# Rather than support HTTPS the HTTP client was removed from libxml2 / xmllint:
|
53
|
+
# https://gitlab.gnome.org/GNOME/libxml2/-/issues/160
|
54
|
+
# I am not sure what this means for Nokogiri or this issue, but it certainly means something will change soon.
|
55
|
+
# Disable this test until it becomes clear what the new behavior should be.
|
56
|
+
# def test_format_dtd_validates
|
57
|
+
# xml = @formatter.format(@result)
|
58
|
+
# options = Nokogiri::XML::ParseOptions::DTDLOAD
|
59
|
+
# doc = Nokogiri::XML::Document.parse(xml, nil, nil, options)
|
60
|
+
# assert_empty doc.external_subset.validate(doc)
|
61
|
+
# end
|
58
62
|
|
59
63
|
def test_no_groups
|
60
64
|
xml = @formatter.format(@result)
|
@@ -86,7 +90,7 @@ class CoberturaFormatterTest < Test::Unit::TestCase
|
|
86
90
|
classes = doc.xpath '/coverage/packages/package/classes/class'
|
87
91
|
assert_equal 1, classes.length
|
88
92
|
clazz = classes.first
|
89
|
-
assert_equal 'simplecov-cobertura_test', clazz.attribute('name').value
|
93
|
+
assert_equal 'test/simplecov-cobertura_test.rb', clazz.attribute('name').value
|
90
94
|
assert_equal 'test/simplecov-cobertura_test.rb', clazz.attribute('filename').value
|
91
95
|
assert_equal '0.86', clazz.attribute('line-rate').value
|
92
96
|
assert_equal '0.5', clazz.attribute('branch-rate').value
|
@@ -136,7 +140,7 @@ class CoberturaFormatterTest < Test::Unit::TestCase
|
|
136
140
|
classes = doc.xpath '/coverage/packages/package/classes/class'
|
137
141
|
assert_equal 1, classes.length
|
138
142
|
clazz = classes.first
|
139
|
-
assert_equal 'simplecov-cobertura_test', clazz.attribute('name').value
|
143
|
+
assert_equal 'test/simplecov-cobertura_test.rb', clazz.attribute('name').value
|
140
144
|
assert_equal 'test/simplecov-cobertura_test.rb', clazz.attribute('filename').value
|
141
145
|
assert_equal '0.86', clazz.attribute('line-rate').value
|
142
146
|
assert_equal '0.5', clazz.attribute('branch-rate').value
|
@@ -165,7 +169,7 @@ class CoberturaFormatterTest < Test::Unit::TestCase
|
|
165
169
|
classes = doc.xpath '/coverage/packages/package/classes/class'
|
166
170
|
assert_equal 1, classes.length
|
167
171
|
clazz = classes.first
|
168
|
-
assert_equal
|
172
|
+
assert_equal "../#{expected_base}/test/simplecov-cobertura_test.rb", clazz.attribute('name').value
|
169
173
|
assert_equal "../#{expected_base}/test/simplecov-cobertura_test.rb", clazz.attribute('filename').value
|
170
174
|
ensure
|
171
175
|
SimpleCov.root(old_root)
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-cobertura
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Bowes
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: test-unit
|
@@ -82,7 +81,7 @@ dependencies:
|
|
82
81
|
version: '0'
|
83
82
|
description: Produces Cobertura XML formatted output from SimpleCov
|
84
83
|
email:
|
85
|
-
-
|
84
|
+
- jessebowes@acm.org
|
86
85
|
executables: []
|
87
86
|
extensions: []
|
88
87
|
extra_rdoc_files: []
|
@@ -96,13 +95,11 @@ files:
|
|
96
95
|
- lib/simplecov-cobertura.rb
|
97
96
|
- lib/simplecov-cobertura/version.rb
|
98
97
|
- simplecov-cobertura.gemspec
|
99
|
-
- test/coverage/coverage.xml
|
100
98
|
- test/simplecov-cobertura_test.rb
|
101
|
-
homepage: https://github.com/
|
99
|
+
homepage: https://github.com/jessebs/simplecov-cobertura
|
102
100
|
licenses:
|
103
101
|
- Apache-2.0
|
104
102
|
metadata: {}
|
105
|
-
post_install_message:
|
106
103
|
rdoc_options: []
|
107
104
|
require_paths:
|
108
105
|
- lib
|
@@ -117,10 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
114
|
- !ruby/object:Gem::Version
|
118
115
|
version: '0'
|
119
116
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
121
|
-
signing_key:
|
117
|
+
rubygems_version: 3.6.7
|
122
118
|
specification_version: 4
|
123
119
|
summary: SimpleCov Cobertura Formatter
|
124
120
|
test_files:
|
125
|
-
- test/coverage/coverage.xml
|
126
121
|
- test/simplecov-cobertura_test.rb
|
data/test/coverage/coverage.xml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
<?xml version='1.0'?>
|
2
|
-
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
3
|
-
<!-- Generated by simplecov-cobertura version 1.4.3-dev (https://github.com/dashingrocket/simplecov-cobertura) -->
|
4
|
-
<coverage line-rate="1.0" branch-rate="0" lines-covered="2" lines-valid="2" branches-covered="0" branches-valid="0" complexity="0" version="0" timestamp="1636204971">
|
5
|
-
<sources>
|
6
|
-
<source>/Users/st0012/projects/simplecov-cobertura/test</source>
|
7
|
-
</sources>
|
8
|
-
<packages>
|
9
|
-
<package name="test" line-rate="1.0" branch-rate="0" complexity="0">
|
10
|
-
<classes>
|
11
|
-
<class name="simplecov-cobertura_test" filename="simplecov-cobertura_test.rb" line-rate="1.0" branch-rate="0" complexity="0">
|
12
|
-
<methods/>
|
13
|
-
<lines>
|
14
|
-
<line number="1" branch="false" hits="1"/>
|
15
|
-
<line number="2" branch="false" hits="2"/>
|
16
|
-
</lines>
|
17
|
-
</class>
|
18
|
-
</classes>
|
19
|
-
</package>
|
20
|
-
</packages>
|
21
|
-
</coverage>
|