simplecov 1.1.0 → 1.1.1
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/README.md +30 -65
- data/lib/simplecov/color.rb +4 -0
- data/lib/simplecov/exit_codes.rb +4 -0
- data/lib/simplecov/formatter/base.rb +5 -0
- data/lib/simplecov/formatter/html_formatter/public/index.html +11 -10
- data/lib/simplecov/parallel_adapters/generic.rb +7 -6
- data/lib/simplecov/parallel_adapters.rb +4 -2
- data/lib/simplecov/result_adapter.rb +2 -0
- data/lib/simplecov/simulate_coverage.rb +1 -0
- data/lib/simplecov/version.rb +1 -1
- data/lib/simplecov.rb +2 -1
- metadata +3 -5
- data/schemas/coverage-v1.0.schema.json +0 -306
- data/schemas/coverage.schema.json +0 -306
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9446e795d35024cc5d47004e88956620c65c6f666fe387323f4192947e942125
|
|
4
|
+
data.tar.gz: 85596147a4854e414574ab09b7329ffd1e949aa6a1f108308e1364712f19b491
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12e270b345de7dd7f2abaaafe9ab9d3034b4c6489e9c465a7bfb0d71de1f66382053e0c43621ac57a49f4194503bbcc692107f1770e3775986ac023dbb06a23c
|
|
7
|
+
data.tar.gz: 50a81cb51a4186ac664ca01003c4d7ae3ed8b1e0dff7abdf83ce359c490e016fb6f8d4f0fa5e69433934978b8be1f08e8cd530900538d377f4d508771e055323
|
data/README.md
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
SimpleCov [](https://badge.fury.io/rb/simplecov) [][
|
|
1
|
+
SimpleCov [](https://badge.fury.io/rb/simplecov) [][ci] [](https://github.com/simplecov-ruby/simplecov/actions/workflows/lint.yml) [](https://github.com/simplecov-ruby/simplecov/actions/workflows/typecheck.yml) [](https://codeclimate.com/github/simplecov-ruby/simplecov/maintainability)
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
4
|
**Code coverage for Ruby**
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* [Configuration]
|
|
8
|
-
* [Changelog]
|
|
9
|
-
|
|
10
|
-
[Coverage]: https://docs.ruby-lang.org/en/master/Coverage.html "API doc for Ruby's Coverage library"
|
|
11
|
-
[API documentation]: http://rubydoc.info/gems/simplecov/frames "RDoc API Documentation at Rubydoc.info"
|
|
12
|
-
[Configuration]: http://rubydoc.info/gems/simplecov/SimpleCov/Configuration "Configuration options API documentation"
|
|
13
|
-
[Changelog]: https://github.com/simplecov-ruby/simplecov/blob/main/docs/Changelog.md "Project Changelog"
|
|
14
|
-
[Continuous Integration]: https://github.com/simplecov-ruby/simplecov/actions?query=workflow%3Astable "SimpleCov is built around the clock by github.com"
|
|
6
|
+
[ci]: https://github.com/simplecov-ruby/simplecov/actions?query=workflow%3Astable
|
|
15
7
|
|
|
16
8
|
SimpleCov is a code coverage analysis tool for Ruby. It uses [Ruby's built-in
|
|
17
9
|
Coverage][Coverage] library to gather coverage data, but makes processing the
|
|
@@ -19,20 +11,20 @@ results much easier by providing a clean API to filter, group, merge, format,
|
|
|
19
11
|
and display them. You can get a full coverage setup running in a couple of
|
|
20
12
|
lines of code.
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
[Coverage]: https://docs.ruby-lang.org/en/master/Coverage.html
|
|
15
|
+
|
|
16
|
+
SimpleCov tracks covered Ruby code.
|
|
25
17
|
|
|
26
|
-
In most cases you'll want overall coverage results spanning all of your tests
|
|
27
|
-
unit
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
blank spots.
|
|
18
|
+
In most cases you'll want overall coverage results spanning all of your tests
|
|
19
|
+
(unit, integration, etc.). SimpleCov handles this automatically by caching and
|
|
20
|
+
merging results as it generates reports, so a report reflects coverage across
|
|
21
|
+
your whole test suite and gives you a truer picture of your blank spots.
|
|
31
22
|
|
|
32
|
-
SimpleCov bundles two formatters
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
SimpleCov bundles two formatters: the default HTML formatter (which renders the
|
|
24
|
+
browsable report) and a JSON formatter. Both were once separate gems
|
|
25
|
+
(`simplecov-html` and `simplecov_json_formatter`) but are now built into
|
|
26
|
+
SimpleCov and configured automatically when you launch it. A wide variety of
|
|
27
|
+
[alternate formatters](docs/Alternate_Formatters.md) are distributed as gems.
|
|
36
28
|
|
|
37
29
|
## Getting started
|
|
38
30
|
|
|
@@ -61,10 +53,12 @@ now built into SimpleCov and configured automatically when you launch it.
|
|
|
61
53
|
> that keep your app loaded between runs, like Spring. See the
|
|
62
54
|
> [Spring section](docs/Troubleshooting.md#using-spring-with-simplecov).
|
|
63
55
|
|
|
64
|
-
SimpleCov must run in the process you want to analyze. When you test a
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
SimpleCov must run in the process you want to analyze. When you test a
|
|
57
|
+
server process (e.g. a JSON API) from a separate test process (e.g. via
|
|
58
|
+
Selenium) and want to see all the code the `rails server` executes, not just
|
|
59
|
+
the code in your test files, require SimpleCov in the server process. For
|
|
60
|
+
Rails, add this near the top of `bin/rails`, below the shebang and after
|
|
61
|
+
`config/boot` is required:
|
|
68
62
|
|
|
69
63
|
```ruby
|
|
70
64
|
if ENV['RAILS_ENV'] == 'test'
|
|
@@ -92,8 +86,9 @@ now built into SimpleCov and configured automatically when you launch it.
|
|
|
92
86
|
echo coverage >> .gitignore
|
|
93
87
|
```
|
|
94
88
|
|
|
95
|
-
For Rails applications, SimpleCov ships a built-in `rails`
|
|
96
|
-
|
|
89
|
+
For Rails applications, SimpleCov ships a built-in `rails`
|
|
90
|
+
[profile](docs/Configuration.md#profiles) that sets up groups for your
|
|
91
|
+
Controllers, Models, Helpers, and Libraries:
|
|
97
92
|
|
|
98
93
|
```ruby
|
|
99
94
|
require 'simplecov'
|
|
@@ -102,18 +97,19 @@ SimpleCov.start 'rails'
|
|
|
102
97
|
|
|
103
98
|
## Example output
|
|
104
99
|
|
|
105
|
-
|
|
100
|
+
#### Coverage results report
|
|
106
101
|
|
|
107
|
-

|
|
108
103
|
|
|
109
|
-
|
|
104
|
+
#### Source file coverage details view
|
|
110
105
|
|
|
111
|
-

|
|
112
107
|
|
|
113
108
|
## Configuration at a glance
|
|
114
109
|
|
|
115
|
-
Configuration goes in your start block, or in a `.simplecov` file at the
|
|
116
|
-
it. Some of the most common
|
|
110
|
+
Configuration goes in your start block, or in a `.simplecov` file at the
|
|
111
|
+
project root when several test suites share it. Some of the most common
|
|
112
|
+
settings:
|
|
117
113
|
|
|
118
114
|
```ruby
|
|
119
115
|
SimpleCov.start do
|
|
@@ -131,34 +127,3 @@ end
|
|
|
131
127
|
|
|
132
128
|
Every option is documented in [docs/Configuration.md](docs/Configuration.md),
|
|
133
129
|
including criteria, filters, groups, profiles, and thresholds.
|
|
134
|
-
|
|
135
|
-
## Documentation
|
|
136
|
-
|
|
137
|
-
| Guide | Contents |
|
|
138
|
-
|-------|----------|
|
|
139
|
-
| [Configuration](docs/Configuration.md) | Configuration formats and `.simplecov`, coverage criteria (branch, method, oneshot, eval), filters, groups, profiles, coverage thresholds, migrating from the legacy API |
|
|
140
|
-
| [Merging & parallel tests](docs/Parallelism.md) | Test suite names, merging within and across machines, `SimpleCov.collate`, forked/spawned subprocesses, parallel-test-runner adapters |
|
|
141
|
-
| [Formatters & output](docs/Formatters.md) | The HTML and JSON formatters, formatter options, the `coverage.json` schema, error output and color |
|
|
142
|
-
| [Command-line interface](docs/CLI.md) | The `simplecov` executable: `run`, `coverage`, `report`, `uncovered`, `merge`, `diff`, `open`, `serve`, `clean` |
|
|
143
|
-
| [Compatibility & troubleshooting](docs/Troubleshooting.md) | Ruby/JRuby support, framework quirks, Spring, local-vs-CI drift, missing coverage, upgrading from 0.x |
|
|
144
|
-
|
|
145
|
-
## Contributing
|
|
146
|
-
|
|
147
|
-
* [Issue Tracker](https://github.com/simplecov-ruby/simplecov/issues) for code and bug reports. See
|
|
148
|
-
[Contributing](https://github.com/simplecov-ruby/simplecov/blob/main/docs/Contributing.md) for how to contribute,
|
|
149
|
-
along with common problems to check before creating an issue.
|
|
150
|
-
* [Mailing List](https://groups.google.com/forum/#!forum/simplecov) for discussion and announcements, hosted on
|
|
151
|
-
Google Groups.
|
|
152
|
-
|
|
153
|
-
## Code of Conduct
|
|
154
|
-
|
|
155
|
-
Everyone participating in this project's development, issue trackers, and other channels is expected to follow our
|
|
156
|
-
[Code of Conduct](./docs/Code_of_Conduct.md).
|
|
157
|
-
|
|
158
|
-
## Kudos
|
|
159
|
-
|
|
160
|
-
Thanks to Aaron Patterson for the original idea for this!
|
|
161
|
-
|
|
162
|
-
## Copyright
|
|
163
|
-
|
|
164
|
-
Copyright (c) 2010-2026 Erik Berlin, Benjamin Fleischer, Akira Matsuda, Christoph Olszowka, Tobias Pfeiffer, David Rodríguez, and Xavier Shay. See LICENSE for details.
|
data/lib/simplecov/color.rb
CHANGED
|
@@ -45,6 +45,10 @@ module SimpleCov
|
|
|
45
45
|
return true if env_set?("FORCE_COLOR")
|
|
46
46
|
|
|
47
47
|
stream.tty?
|
|
48
|
+
rescue IOError
|
|
49
|
+
# A parallel runner can close a worker's stdio before its at_exit
|
|
50
|
+
# hooks run (rspec-conductor does). A closed stream is not a tty.
|
|
51
|
+
false
|
|
48
52
|
end
|
|
49
53
|
|
|
50
54
|
def for_percent(percent)
|
data/lib/simplecov/exit_codes.rb
CHANGED
|
@@ -18,6 +18,10 @@ module SimpleCov
|
|
|
18
18
|
# warning logs. `print_errors false` remains the intended opt-out.
|
|
19
19
|
def self.print_error(message)
|
|
20
20
|
$stderr.puts message # rubocop:disable Style/StderrPuts
|
|
21
|
+
rescue IOError
|
|
22
|
+
# A parallel runner can close a worker's stderr before its at_exit
|
|
23
|
+
# hooks run (rspec-conductor does). The violation still has to set
|
|
24
|
+
# the exit status even when its explanation cannot be printed.
|
|
21
25
|
end
|
|
22
26
|
end
|
|
23
27
|
end
|
|
@@ -32,6 +32,11 @@ module SimpleCov
|
|
|
32
32
|
# Subclasses call this at the end of their `format`.
|
|
33
33
|
def emit_status(result)
|
|
34
34
|
$stderr.puts output_message(result) unless @silent # rubocop:disable Style/StderrPuts
|
|
35
|
+
rescue IOError
|
|
36
|
+
# A parallel runner can close a worker's stderr before its at_exit
|
|
37
|
+
# hooks run (rspec-conductor does). Losing the status line must not
|
|
38
|
+
# abort the exit tasks that follow report generation, i.e. the
|
|
39
|
+
# threshold checks and the .last_run.json write.
|
|
35
40
|
end
|
|
36
41
|
|
|
37
42
|
# Subclasses override to prepend a marker (e.g. "JSON ") to the
|