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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5b7fe84daa130262d92455786fafd60338d59b5bfc62d69a724513fcd2ab0be
4
- data.tar.gz: b0fe63d82fd771342d4ff59186b8896375d398eb2af202e2e2d752474c88d102
3
+ metadata.gz: 9446e795d35024cc5d47004e88956620c65c6f666fe387323f4192947e942125
4
+ data.tar.gz: 85596147a4854e414574ab09b7329ffd1e949aa6a1f108308e1364712f19b491
5
5
  SHA512:
6
- metadata.gz: 4599f4e75d31d14a892c58bc425ceb10610fe9beef0e59a9ecd87ee4de2d157b9cace3f42ca89384938e59053a5738f222f33cdef737a99d18e4afefa04a7ad7
7
- data.tar.gz: be134a2161d4a9d0185730925cea7e69cb9497ffd689da62877288d8c5d65cbf4cf2d5def2b4c905ccda6d87f85d8fbc9b99251097bdf237492e6ab59626531c
6
+ metadata.gz: 12e270b345de7dd7f2abaaafe9ab9d3034b4c6489e9c465a7bfb0d71de1f66382053e0c43621ac57a49f4194503bbcc692107f1770e3775986ac023dbb06a23c
7
+ data.tar.gz: 50a81cb51a4186ac664ca01003c4d7ae3ed8b1e0dff7abdf83ce359c490e016fb6f8d4f0fa5e69433934978b8be1f08e8cd530900538d377f4d508771e055323
data/README.md CHANGED
@@ -1,17 +1,9 @@
1
- SimpleCov [![Gem Version](https://badge.fury.io/rb/simplecov.svg)](https://badge.fury.io/rb/simplecov) [![Build Status](https://github.com/simplecov-ruby/simplecov/actions/workflows/stable.yml/badge.svg?branch=main)][Continuous Integration] [![Lint](https://github.com/simplecov-ruby/simplecov/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/simplecov-ruby/simplecov/actions/workflows/lint.yml) [![Typecheck](https://github.com/simplecov-ruby/simplecov/actions/workflows/typecheck.yml/badge.svg?branch=main)](https://github.com/simplecov-ruby/simplecov/actions/workflows/typecheck.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/c071d197d61953a7e482/maintainability)](https://codeclimate.com/github/simplecov-ruby/simplecov/maintainability)
1
+ SimpleCov [![Gem Version](https://badge.fury.io/rb/simplecov.svg)](https://badge.fury.io/rb/simplecov) [![Build Status](https://github.com/simplecov-ruby/simplecov/actions/workflows/stable.yml/badge.svg?branch=main)][ci] [![Lint](https://github.com/simplecov-ruby/simplecov/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/simplecov-ruby/simplecov/actions/workflows/lint.yml) [![Typecheck](https://github.com/simplecov-ruby/simplecov/actions/workflows/typecheck.yml/badge.svg?branch=main)](https://github.com/simplecov-ruby/simplecov/actions/workflows/typecheck.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/c071d197d61953a7e482/maintainability)](https://codeclimate.com/github/simplecov-ruby/simplecov/maintainability)
2
2
  =========
3
3
 
4
4
  **Code coverage for Ruby**
5
5
 
6
- * [API documentation]
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
- SimpleCov tracks covered Ruby code. It does not gather coverage for templating
23
- languages like ERB, Slim, and Haml, though ERB can be measured through
24
- [eval coverage](docs/Configuration.md#eval-coverage).
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 tests, Cucumber features, and so on. SimpleCov handles this automatically
28
- by caching and merging results as it generates reports, so a report reflects
29
- coverage across your whole test suite and gives you a truer picture of your
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 that need no extra gems: the default HTML
33
- formatter (which renders the browsable report) and a JSON formatter. Both were
34
- once separate gems (`simplecov-html` and `simplecov_json_formatter`) but are
35
- now built into SimpleCov and configured automatically when you launch it.
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 server process (e.g. a JSON API) from a
65
- separate test process (e.g. via Selenium) and want to see all the code the `rails server` executes, not just the
66
- code in your test files, require SimpleCov in the server process. For Rails, add this near the top of `bin/rails`,
67
- below the shebang and after `config/boot` is required:
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` [profile](docs/Configuration.md#profiles) that sets up
96
- groups for your Controllers, Models, Helpers, and Libraries:
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
- **Coverage results report, fully browsable locally with sorting and much more:**
100
+ #### Coverage results report
106
101
 
107
- ![SimpleCov coverage report](https://github.com/user-attachments/assets/33275385-e0f3-482d-b63e-2a6cd4965fe0)
102
+ ![SimpleCov coverage report](https://github.com/user-attachments/assets/19cbbf09-e42e-49c2-9adc-2427f321cb7f)
108
103
 
109
- **Source file coverage details view:**
104
+ #### Source file coverage details view
110
105
 
111
- ![SimpleCov source file detail view](https://github.com/user-attachments/assets/abcd93b4-a45d-48bb-a0e4-6129c4429193)
106
+ ![SimpleCov source file detail view](https://github.com/user-attachments/assets/c168597d-a82c-453a-825b-3fb229979c5e)
112
107
 
113
108
  ## Configuration at a glance
114
109
 
115
- Configuration goes in your start block, or in a `.simplecov` file at the project root when several test suites share
116
- it. Some of the most common settings:
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.
@@ -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)
@@ -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