simplecov 0.21.2 → 0.22.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 +10 -0
- data/README.md +20 -8
- data/lib/simplecov/configuration.rb +20 -1
- data/lib/simplecov/source_file.rb +9 -3
- data/lib/simplecov/version.rb +1 -1
- data/lib/simplecov.rb +4 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53fa0b46a6da5abd78be052c332c7bc956bb9a432e929965f1cfd460d637c21d
|
4
|
+
data.tar.gz: 714c61ef2abd25f9fc78e0f56681811eb571904c9348775acf5b7b13ad002dfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2e715ac3b3067755b2f32981359736cbb5335606b83e84523b03b37d93804d39bbd1f40099d78058d21dad038623911eb031d672fbad97f1fdaa292b2c3652b
|
7
|
+
data.tar.gz: 9155c02eba7b6389c8e19de0c28a2b78017999ca404cadfbaa3cde1ee2012e0420d86471af81b0ced38dedef26bde60e7130fb86965fbb4021663fbb75c96554
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
0.22.0 (2022-12-23)
|
2
|
+
==========
|
3
|
+
|
4
|
+
## Enhancements
|
5
|
+
|
6
|
+
* On Ruby 3.2+, you can now use the new Coverage library feature for `eval` - See https://github.com/simplecov-ruby/simplecov/pull/1037. Thanks [@mame](https://github.com/mame)!
|
7
|
+
|
8
|
+
## Bugfixes
|
9
|
+
* Fix for making the test suite pass against the upcoming Ruby 3.2 - See https://github.com/simplecov-ruby/simplecov/pull/1035. Thanks [@mame](https://github.com/mame)
|
10
|
+
|
1
11
|
0.21.2 (2021-01-09)
|
2
12
|
==========
|
3
13
|
|
data/README.md
CHANGED
@@ -69,6 +69,8 @@ Getting started
|
|
69
69
|
The `SimpleCov.start` **must** be issued **before any of your application
|
70
70
|
code is required!**
|
71
71
|
|
72
|
+
This is especially true if you use anything that keeps your tests application loaded like spring, check out the **[spring section](#want-to-use-spring-with-simplecov)**.
|
73
|
+
|
72
74
|
SimpleCov must be running in the process that you want the code coverage
|
73
75
|
analysis to happen on. When testing a server process (e.g. a JSON API
|
74
76
|
endpoint) via a separate test process (e.g. when using Selenium) where you
|
@@ -105,10 +107,6 @@ Getting started
|
|
105
107
|
5. Add the following to your `.gitignore` file to ensure that coverage results
|
106
108
|
are not tracked by Git (optional):
|
107
109
|
|
108
|
-
```
|
109
|
-
echo "coverage" >> .gitignore
|
110
|
-
```
|
111
|
-
Or if you use Windows:
|
112
110
|
```
|
113
111
|
echo coverage >> .gitignore
|
114
112
|
```
|
@@ -356,6 +354,18 @@ Primary coverage determines what will come in first all output, and the type of
|
|
356
354
|
|
357
355
|
Note that coverage must first be enabled for non-default coverage types.
|
358
356
|
|
357
|
+
## Coverage for eval
|
358
|
+
|
359
|
+
You can measure coverage for code that is evaluated by `Kernel#eval`. Supported in CRuby versions 3.2+.
|
360
|
+
|
361
|
+
```ruby
|
362
|
+
SimpleCov.start do
|
363
|
+
enable_coverage_for_eval
|
364
|
+
end
|
365
|
+
```
|
366
|
+
|
367
|
+
This is typically useful for ERB. Set `ERB#filename=` to make it possible for SimpleCov to trace the original .erb source file.
|
368
|
+
|
359
369
|
## Filters
|
360
370
|
|
361
371
|
Filters can be used to remove selected files from your coverage data. By default, a filter is applied that removes all
|
@@ -840,15 +850,17 @@ You can use your own formatter with:
|
|
840
850
|
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
841
851
|
```
|
842
852
|
|
843
|
-
|
844
|
-
|
853
|
+
Calling `SimpleCov.result.format!` will be invoked with `SimpleCov::Formatter::YourFormatter.new.format(result)`,
|
854
|
+
and `result` is an instance of `SimpleCov::Result`. Do whatever your wish with that!
|
845
855
|
|
846
856
|
|
847
857
|
## Using multiple formatters
|
848
858
|
|
849
|
-
As of SimpleCov 0.9, you can specify multiple result formats
|
859
|
+
As of SimpleCov 0.9, you can specify multiple result formats. Formatters besides the default HTML formatter require separate gems, however.
|
850
860
|
|
851
861
|
```ruby
|
862
|
+
require "simplecov-html"
|
863
|
+
|
852
864
|
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
|
853
865
|
SimpleCov::Formatter::HTMLFormatter,
|
854
866
|
SimpleCov::Formatter::CSVFormatter,
|
@@ -877,7 +889,7 @@ SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
|
|
877
889
|
|
878
890
|
## Ruby version compatibility
|
879
891
|
|
880
|
-
SimpleCov is built in [Continuous Integration] on Ruby 2.
|
892
|
+
SimpleCov is built in [Continuous Integration] on Ruby 2.7+ as well as JRuby 9.3+.
|
881
893
|
|
882
894
|
Note for JRuby => You need to pass JRUBY_OPTS="--debug" or create .jrubyrc and add debug.fullTrace=true
|
883
895
|
|
@@ -440,7 +440,26 @@ module SimpleCov
|
|
440
440
|
end
|
441
441
|
end
|
442
442
|
|
443
|
-
|
443
|
+
def branch_coverage_supported?
|
444
|
+
coverage_start_arguments_supported? && RUBY_ENGINE != "jruby"
|
445
|
+
end
|
446
|
+
|
447
|
+
def coverage_for_eval_supported?
|
448
|
+
require "coverage"
|
449
|
+
defined?(Coverage.supported?) && Coverage.supported?(:eval)
|
450
|
+
end
|
451
|
+
|
452
|
+
def coverage_for_eval_enabled?
|
453
|
+
@coverage_for_eval_enabled ||= false
|
454
|
+
end
|
455
|
+
|
456
|
+
def enable_coverage_for_eval
|
457
|
+
if coverage_for_eval_supported?
|
458
|
+
@coverage_for_eval_enabled = true
|
459
|
+
else
|
460
|
+
warn "Coverage for eval is not available; Use Ruby 3.2.0 or later"
|
461
|
+
end
|
462
|
+
end
|
444
463
|
|
445
464
|
private
|
446
465
|
|
@@ -18,7 +18,7 @@ module SimpleCov
|
|
18
18
|
|
19
19
|
# The path to this source file relative to the projects directory
|
20
20
|
def project_filename
|
21
|
-
@filename.
|
21
|
+
@filename.delete_prefix(SimpleCov.root)
|
22
22
|
end
|
23
23
|
|
24
24
|
# The source code for this file. Aliased as :source
|
@@ -217,7 +217,13 @@ module SimpleCov
|
|
217
217
|
# simplecov-html to have encoding shenaningans in one place. See #866
|
218
218
|
# also setting these option on `file.set_encoding` doesn't seem to work
|
219
219
|
# properly so it has to be done here.
|
220
|
-
file_lines.each
|
220
|
+
file_lines.each do |line|
|
221
|
+
if line.encoding == Encoding::UTF_8
|
222
|
+
line
|
223
|
+
else
|
224
|
+
line.encode!("UTF-8", invalid: :replace, undef: :replace)
|
225
|
+
end
|
226
|
+
end
|
221
227
|
end
|
222
228
|
|
223
229
|
def build_lines
|
@@ -238,7 +244,7 @@ module SimpleCov
|
|
238
244
|
end
|
239
245
|
|
240
246
|
def lines_strength
|
241
|
-
lines.
|
247
|
+
lines.sum { |line| line.coverage.to_i }
|
242
248
|
end
|
243
249
|
|
244
250
|
# Warning to identify condition from Issue #56
|
data/lib/simplecov/version.rb
CHANGED
data/lib/simplecov.rb
CHANGED
@@ -342,7 +342,7 @@ module SimpleCov
|
|
342
342
|
if coverage_start_arguments_supported?
|
343
343
|
start_coverage_with_criteria
|
344
344
|
else
|
345
|
-
Coverage.start
|
345
|
+
Coverage.start unless Coverage.running?
|
346
346
|
end
|
347
347
|
end
|
348
348
|
|
@@ -351,7 +351,9 @@ module SimpleCov
|
|
351
351
|
[lookup_corresponding_ruby_coverage_name(criterion), true]
|
352
352
|
end.to_h
|
353
353
|
|
354
|
-
|
354
|
+
start_arguments[:eval] = true if coverage_for_eval_enabled?
|
355
|
+
|
356
|
+
Coverage.start(start_arguments) unless Coverage.running?
|
355
357
|
end
|
356
358
|
|
357
359
|
CRITERION_TO_RUBY_COVERAGE = {
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Olszowka
|
8
8
|
- Tobias Pfeiffer
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: docile
|
@@ -116,10 +116,10 @@ licenses:
|
|
116
116
|
metadata:
|
117
117
|
bug_tracker_uri: https://github.com/simplecov-ruby/simplecov/issues
|
118
118
|
changelog_uri: https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md
|
119
|
-
documentation_uri: https://www.rubydoc.info/gems/simplecov/0.
|
119
|
+
documentation_uri: https://www.rubydoc.info/gems/simplecov/0.22.0
|
120
120
|
mailing_list_uri: https://groups.google.com/forum/#!forum/simplecov
|
121
|
-
source_code_uri: https://github.com/simplecov-ruby/simplecov/tree/v0.
|
122
|
-
post_install_message:
|
121
|
+
source_code_uri: https://github.com/simplecov-ruby/simplecov/tree/v0.22.0
|
122
|
+
post_install_message:
|
123
123
|
rdoc_options: []
|
124
124
|
require_paths:
|
125
125
|
- lib
|
@@ -134,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
138
|
-
signing_key:
|
137
|
+
rubygems_version: 3.3.7
|
138
|
+
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Code coverage for Ruby
|
141
141
|
test_files: []
|