simplecov 1.0.0 → 1.0.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/lib/simplecov/cli/coverage.rb +5 -3
- data/lib/simplecov/cli/diff.rb +2 -1
- data/lib/simplecov/cli/dotfile.rb +9 -4
- data/lib/simplecov/cli/merge.rb +5 -3
- data/lib/simplecov/cli/report.rb +11 -6
- data/lib/simplecov/cli/run.rb +1 -1
- data/lib/simplecov/cli/serve.rb +17 -7
- data/lib/simplecov/cli/uncovered.rb +2 -1
- data/lib/simplecov/combine/branches_combiner.rb +2 -1
- data/lib/simplecov/combine/results_combiner.rb +2 -1
- data/lib/simplecov/configuration/coverage.rb +6 -2
- data/lib/simplecov/configuration/coverage_criteria.rb +3 -1
- data/lib/simplecov/configuration/formatting.rb +17 -7
- data/lib/simplecov/configuration/thresholds.rb +13 -9
- data/lib/simplecov/configuration.rb +22 -13
- data/lib/simplecov/coverage_statistics.rb +4 -1
- data/lib/simplecov/coverage_violations.rb +2 -1
- data/lib/simplecov/defaults.rb +3 -3
- data/lib/simplecov/directive.rb +8 -3
- data/lib/simplecov/exit_codes/maximum_coverage_drop_check.rb +1 -1
- data/lib/simplecov/exit_codes/maximum_overall_coverage_check.rb +1 -1
- data/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb +1 -1
- data/lib/simplecov/exit_codes/minimum_coverage_by_group_check.rb +1 -1
- data/lib/simplecov/exit_codes/minimum_overall_coverage_check.rb +3 -3
- data/lib/simplecov/exit_codes.rb +12 -0
- data/lib/simplecov/exit_handling.rb +3 -3
- data/lib/simplecov/file_list.rb +12 -5
- data/lib/simplecov/formatter/base.rb +2 -1
- data/lib/simplecov/formatter/html_formatter.rb +13 -7
- data/lib/simplecov/formatter/json_formatter/errors_formatter.rb +9 -3
- data/lib/simplecov/formatter/json_formatter/result_hash_formatter.rb +1 -1
- data/lib/simplecov/formatter/json_formatter/source_file_formatter.rb +1 -1
- data/lib/simplecov/formatter/json_formatter.rb +4 -2
- data/lib/simplecov/formatter/multi_formatter.rb +7 -2
- data/lib/simplecov/formatter/simple_formatter.rb +3 -1
- data/lib/simplecov/process.rb +22 -0
- data/lib/simplecov/result_adapter.rb +2 -1
- data/lib/simplecov/result_processing.rb +4 -4
- data/lib/simplecov/simulate_coverage.rb +2 -2
- data/lib/simplecov/source_file/line.rb +2 -2
- data/lib/simplecov/source_file/method.rb +1 -1
- data/lib/simplecov/source_file/method_builder.rb +3 -1
- data/lib/simplecov/source_file/source_loader.rb +2 -2
- data/lib/simplecov/source_file.rb +2 -2
- data/lib/simplecov/static_coverage_extractor/location_conventions.rb +158 -0
- data/lib/simplecov/static_coverage_extractor/visitor.rb +9 -45
- data/lib/simplecov/version.rb +1 -1
- data/lib/simplecov.rb +24 -11
- data/sig/simplecov.rbs +1638 -0
- metadata +5 -3
data/lib/simplecov.rb
CHANGED
|
@@ -8,14 +8,18 @@ module SimpleCov
|
|
|
8
8
|
# every coverage criterion has been disabled.
|
|
9
9
|
class ConfigurationError < StandardError; end
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
# Maps SimpleCov's criterion names to the keys `Coverage.start` expects.
|
|
12
|
+
# Lives at module scope (not inside `class << self`) so it can be
|
|
13
|
+
# declared in the RBS signatures; lexical scoping keeps every existing
|
|
14
|
+
# reference inside the singleton class working.
|
|
15
|
+
CRITERION_TO_RUBY_COVERAGE = {
|
|
16
|
+
branch: :branches,
|
|
17
|
+
line: :lines,
|
|
18
|
+
method: :methods,
|
|
19
|
+
oneshot_line: :oneshot_lines
|
|
20
|
+
}.freeze
|
|
18
21
|
|
|
22
|
+
class << self
|
|
19
23
|
attr_accessor :pid
|
|
20
24
|
# When this process started tracking coverage. Captured by SimpleCov.start
|
|
21
25
|
# so JSONFormatter can detect when an existing coverage.json was written
|
|
@@ -93,10 +97,13 @@ module SimpleCov
|
|
|
93
97
|
# the warning is the cue to move `SimpleCov.start` into a test helper.
|
|
94
98
|
# See #581.
|
|
95
99
|
def with_dot_simplecov_autoload
|
|
96
|
-
|
|
100
|
+
# Read in the ensure clause, where flow analysis cannot see the
|
|
101
|
+
# assignment above; anchor the type here.
|
|
102
|
+
previous = @autoloading_dot_simplecov # : bool?
|
|
97
103
|
@autoloading_dot_simplecov = true
|
|
98
104
|
yield
|
|
99
105
|
ensure
|
|
106
|
+
# @type var previous: bool?
|
|
100
107
|
@autoloading_dot_simplecov = previous
|
|
101
108
|
end
|
|
102
109
|
|
|
@@ -123,7 +130,11 @@ module SimpleCov
|
|
|
123
130
|
return if @at_exit_hook_installed
|
|
124
131
|
|
|
125
132
|
@at_exit_hook_installed = true
|
|
126
|
-
|
|
133
|
+
# Never defer in a forked child: Minitest pins its after_run at_exit
|
|
134
|
+
# to the pid that armed autorun, so the deferral target can't fire
|
|
135
|
+
# there and the child's resultset would be silently dropped. See
|
|
136
|
+
# issue #1227.
|
|
137
|
+
defer_to_minitest_after_run if minitest_autorun_pending? && !forked_subprocess?
|
|
127
138
|
Kernel.at_exit do
|
|
128
139
|
next if SimpleCov.external_at_exit?
|
|
129
140
|
|
|
@@ -173,7 +184,7 @@ module SimpleCov
|
|
|
173
184
|
|
|
174
185
|
start_arguments[:eval] = true if coverage_for_eval_enabled?
|
|
175
186
|
|
|
176
|
-
Coverage.start(start_arguments) unless Coverage.running?
|
|
187
|
+
Coverage.start(**start_arguments) unless Coverage.running?
|
|
177
188
|
end
|
|
178
189
|
|
|
179
190
|
# `Rake::TestTask` runs `ruby -e 'require "minitest/autorun"; ...'`,
|
|
@@ -203,7 +214,9 @@ module SimpleCov
|
|
|
203
214
|
return unless defined?(JRUBY_VERSION) && defined?(JRuby) # simplecov:disable — JRuby-only branch
|
|
204
215
|
|
|
205
216
|
# simplecov:disable — JRuby-only branches; unreachable from CRuby
|
|
206
|
-
|
|
217
|
+
# `org` is JRuby's Java-package entry point; it does not exist on
|
|
218
|
+
# CRuby, so no RBS declaration can be truthful here.
|
|
219
|
+
return if org.jruby.RubyInstanceConfig.FULL_TRACE_ENABLED # steep:ignore NoMethod
|
|
207
220
|
|
|
208
221
|
warn 'Coverage may be inaccurate; set the "--debug" command line option, ' \
|
|
209
222
|
'or do JRUBY_OPTS="--debug" ' \
|