Skip to content

Commit 03d1180

Browse files
committed
Merge remote-tracking branch 'upstream/main' into add-method-coverage-support
2 parents 4904192 + 818bc25 commit 03d1180

File tree

12 files changed

+71
-18
lines changed

12 files changed

+71
-18
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
0.19.1 (2020-10-25)
2+
==========
3+
4+
## Bugfixes
5+
6+
* No more warnings triggered by `enable_for_subprocesses`. Thanks to [@mame](https://github.com/mame)
7+
* Avoid trying to patch `Process.fork` when it isn't available. Thanks to [@MSP-Greg](https://github.com/MSP-Greg)
8+
19
0.19.0 (2020-08-16)
210
==========
311

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
simplecov (0.19.0)
4+
simplecov (0.19.1)
55
docile (~> 1.1)
66
simplecov-html (~> 0.11)
77

@@ -136,7 +136,7 @@ GEM
136136
rubocop-ast (0.3.0)
137137
parser (>= 2.7.1.4)
138138
ruby-progressbar (1.10.1)
139-
simplecov-html (0.12.2)
139+
simplecov-html (0.12.3)
140140
spoon (0.0.6)
141141
ffi
142142
sys-uname (1.2.1)

Rakefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ rescue LoadError
2525
end
2626

2727
require "cucumber/rake/task"
28-
Cucumber::Rake::Task.new
28+
Cucumber::Rake::Task.new do |t|
29+
t.cucumber_opts = %w[--retry 3 --no-strict-flaky]
30+
end
2931

3032
task default: %i[rubocop spec cucumber]

benchmarks/result.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Coverage.start
77
# such meta, many wow
88
require_relative "../lib/simplecov"
9-
require_relative "../spec/faked_project/lib/faked_project"
9+
require_relative "../test_projects/faked_project/lib/faked_project"
1010
result = Coverage.result
1111

1212
class MyFormatter

doc/alternate-formatters.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ A formatter that prints the coverage of the file under test when you run a singl
6060

6161
t_wada AA formatter for SimpleCov
6262

63+
#### [simplecov-tailwindcss](https://github.com/chiefpansancolt/simplecov-tailwindcss)
64+
*by [Chiefpansancolt](https://github.com/chiefpansancolt)*
65+
66+
A TailwindCSS & TailwindUI Designed HTML formatter with clean and easy search of files with a tabular left Navigation.
67+
6368
#### [simplecov-material](https://github.com/chiefpansancolt/simplecov-material)
6469
*by [Chiefpansancolt](https://github.com/chiefpansancolt)*
6570

features/skipping_code_blocks_manually.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ Feature:
5757

5858
When I open the coverage report generated with `bundle exec rake test`
5959

60-
Then I should see the source files:
60+
Then the report should be based upon:
61+
| Unit Tests |
62+
63+
And there should be 7 skipped lines in the source files
64+
65+
And I should see the source files:
6166
| name | coverage |
6267
| lib/faked_project.rb | 100.00 % |
6368
| lib/faked_project/some_class.rb | 80.00 % |
6469
| lib/faked_project/framework_specific.rb | 75.00 % |
6570
| lib/faked_project/meta_magic.rb | 100.00 % |
6671
| lib/faked_project/nocov.rb | 100.00 % |
67-
68-
And there should be 7 skipped lines in the source files
69-
70-
And the report should be based upon:
71-
| Unit Tests |

features/step_definitions/html_steps.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
Then /^I should see the groups:$/ do |table|
44
expected_groups = table.hashes
5-
available_groups = all("#content .file_list_container")
65
# Given group names should be the same number than those rendered in report
7-
expect(expected_groups.count).to eq(available_groups.count)
6+
expect(page).to have_css("#content .file_list_container", count: expected_groups.count)
87

98
# Verify each of the expected groups has a file list container and corresponding title and coverage number
109
# as well as the correct number of links to files.
@@ -23,9 +22,8 @@
2322

2423
Then /^I should see the source files:$/ do |table|
2524
expected_files = table.hashes
26-
available_source_files = all(".t-file", visible: true)
25+
available_source_files = all(".t-file", visible: true, count: expected_files.count)
2726

28-
expect(available_source_files.count).to eq(expected_files.length)
2927
include_branch_coverage = table.column_names.include?("branch coverage")
3028

3129
# Find all filenames and their coverage present in coverage report

features/warnings.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@rspec
2+
Feature:
3+
4+
Running SimpleCov with verbosity enabled does not yield warnings.
5+
6+
Background:
7+
Given I'm working on the project "faked_project"
8+
9+
Scenario:
10+
Given SimpleCov for RSpec is configured with:
11+
"""
12+
require 'simplecov'
13+
SimpleCov.start
14+
"""
15+
16+
When I successfully run `bundle exec rspec --warnings spec`
17+
Then a coverage report should have been generated
18+
And the output should not contain "warning"

lib/simplecov.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ class << self
5050
def start(profile = nil, &block)
5151
require "coverage"
5252
initial_setup(profile, &block)
53-
require_relative "./simplecov/process" if SimpleCov.enabled_for_subprocesses?
53+
require_relative "./simplecov/process" if SimpleCov.enabled_for_subprocesses? &&
54+
::Process.respond_to?(:fork)
55+
5456
make_parallel_tests_available
5557

5658
@result = nil

lib/simplecov/configuration.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ def at_exit(&block)
199199
# gets or sets the enabled_for_subprocess configuration
200200
# when true, this will inject SimpleCov code into Process.fork
201201
def enable_for_subprocesses(value = nil)
202-
@enable_for_subprocesses = value unless value.nil?
203-
@enable_for_subprocesses || false
202+
return @enable_for_subprocesses if defined?(@enable_for_subprocesses) && value.nil?
203+
204+
@enable_for_subprocesses = value || false
204205
end
205206

206207
# gets the enabled_for_subprocess configuration

0 commit comments

Comments
 (0)