Skip to content

Commit 72d4fe7

Browse files
committed
Merge remote-tracking branch 'upstream/main' into add-method-coverage-support
2 parents 8ede952 + 862c937 commit 72d4fe7

34 files changed

+163
-146
lines changed

.github/workflows/stable.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,31 @@ name: stable
33
on: [push, pull_request]
44

55
jobs:
6-
test:
6+
tests:
77
runs-on: ubuntu-latest
8-
9-
strategy:
10-
matrix:
11-
ruby: [2.7, '3.0', 3.1, 3.2, ruby-head, jruby-9.4]
12-
138
env:
149
BUNDLE_WITHOUT: "benchmark"
1510
JRUBY_OPTS: "--debug"
1611
SIMPLECOV_HTML_MODE: "methods" # TODO: remove after simplecov-html release
12+
strategy:
13+
fail-fast: false
14+
15+
matrix:
16+
ruby-version:
17+
- '2.7'
18+
- '3.0'
19+
- '3.1'
20+
- '3.2'
21+
- '3.3'
22+
- jruby-9.4
1723

1824
steps:
1925
- uses: actions/checkout@v4
2026

21-
- name: Setup ruby
22-
uses: ruby/setup-ruby@v1
27+
- uses: ruby/setup-ruby@v1
2328
with:
24-
ruby-version: ${{ matrix.ruby }}
25-
bundler-cache: true # 'bundle install' and cache
29+
ruby-version: ${{ matrix.ruby-version }}
30+
bundler-cache: true
2631

27-
- name: Run tests
28-
run: bundle exec rake
32+
- run: |
33+
bundle exec rake

.github/workflows/unstable.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,28 @@ on:
55
- cron: '0 0 * * *'
66

77
jobs:
8-
test:
8+
tests:
99
runs-on: ubuntu-latest
10-
11-
strategy:
12-
matrix:
13-
ruby: [ruby-head, jruby-head]
14-
1510
env:
1611
BUNDLE_WITHOUT: "benchmark"
1712
JRUBY_OPTS: "--debug"
13+
strategy:
14+
fail-fast: false
15+
16+
matrix:
17+
ruby-version:
18+
- ruby-head
19+
- jruby-head
1820

1921
steps:
2022
- uses: actions/checkout@v4
2123

22-
- name: Setup ruby
23-
uses: ruby/setup-ruby@v1
24+
- uses: ruby/setup-ruby@v1
2425
with:
25-
ruby-version: ${{ matrix.ruby }}
26-
bundler-cache: true # 'bundle install' and cache
26+
ruby-version: ${{ matrix.ruby-version }}
27+
bundler-cache: true
28+
continue-on-error: ${{ (matrix.ruby-version == 'ruby-head') || (matrix.ruby-version == 'jruby-head') }}
2729

28-
- name: Run tests
29-
run: bundle exec rake
30+
- run: |
31+
bundle exec rake
32+
continue-on-error: ${{ (matrix.ruby-version == 'ruby-head') || (matrix.ruby-version == 'jruby-head') }}

.rubocop.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ AllCops:
1010
- "tmp/**/*"
1111
- "vendor/bundle/**/*"
1212
- "vendor/bundle/**/.*"
13-
TargetRubyVersion: 2.5
13+
TargetRubyVersion: 2.7
14+
NewCops: enable
1415
# we might wanna adopt rspec and rake but it's a bit annoying for now
1516
SuggestExtensions: false
1617

Gemfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ gem "matrix"
1717

1818
group :development do
1919
gem "apparition", github: "twalpole/apparition" # LOCKED: When this is released, use a released version https://github.com/twalpole/apparition/pull/79
20+
gem "activesupport", "~> 6.1"
2021
gem "aruba", "~> 1.0"
21-
gem "capybara", "~> 3.31"
22+
gem "capybara"
2223
gem "rackup"
23-
gem "cucumber", "~> 4.0"
24+
gem "cucumber", "~> 6.0"
2425
gem "minitest"
25-
gem "rake", "~> 13.0"
26-
gem "rspec", "~> 3.2"
26+
gem "rake"
27+
gem "rspec"
2728
gem "pry"
2829
gem "rubocop"
2930
gem "test-unit"

Gemfile.lock

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ GIT
66
capybara (~> 3.13, < 4)
77
websocket-driver (>= 0.6.5)
88

9-
GIT
10-
remote: https://github.com/umbrellio/simplecov-html.git
11-
revision: 54879bd1080865cf8013bcda12e0c03ac687d7a9
12-
branch: add-method-coverage-support
13-
specs:
14-
simplecov-html (0.12.3)
15-
169
PATH
1710
remote: .
1811
specs:
@@ -55,38 +48,39 @@ GEM
5548
coderay (1.1.3)
5649
concurrent-ruby (1.1.9)
5750
contracts (0.16.1)
58-
cucumber (4.1.0)
59-
builder (~> 3.2, >= 3.2.3)
60-
cucumber-core (~> 7.1, >= 7.1.0)
61-
cucumber-create-meta (~> 1.0.0, >= 1.0.0)
62-
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
63-
cucumber-gherkin (~> 14.0, >= 14.0.1)
64-
cucumber-html-formatter (~> 7.0, >= 7.0.0)
65-
cucumber-messages (~> 12.2, >= 12.2.0)
66-
cucumber-wire (~> 3.1, >= 3.1.0)
67-
diff-lcs (~> 1.3, >= 1.3, < 1.4)
51+
cucumber (6.1.0)
52+
builder (~> 3.2, >= 3.2.4)
53+
cucumber-core (~> 9.0, >= 9.0.1)
54+
cucumber-create-meta (~> 4.0, >= 4.0.0)
55+
cucumber-cucumber-expressions (~> 12.1, >= 12.1.1)
56+
cucumber-gherkin (~> 18.1, >= 18.1.0)
57+
cucumber-html-formatter (~> 13.0, >= 13.0.0)
58+
cucumber-messages (~> 15.0, >= 15.0.0)
59+
cucumber-wire (~> 5.0, >= 5.0.1)
60+
diff-lcs (~> 1.4, >= 1.4.4)
61+
mime-types (~> 3.3, >= 3.3.1)
6862
multi_test (~> 0.1, >= 0.1.2)
69-
sys-uname (~> 1.0, >= 1.0.2)
70-
cucumber-core (7.1.0)
71-
cucumber-gherkin (~> 14.0, >= 14.0.1)
72-
cucumber-messages (~> 12.2, >= 12.2.0)
73-
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
74-
cucumber-create-meta (1.0.0)
75-
cucumber-messages (~> 12.2, >= 12.2.0)
76-
sys-uname (~> 1.2, >= 1.2.1)
77-
cucumber-cucumber-expressions (10.3.0)
78-
cucumber-gherkin (14.2.0)
79-
cucumber-messages (~> 12.4, >= 12.4.0)
80-
cucumber-html-formatter (7.2.0)
81-
cucumber-messages (~> 12.4, >= 12.4.0)
82-
cucumber-messages (12.4.0)
63+
sys-uname (~> 1.2, >= 1.2.2)
64+
cucumber-core (9.0.1)
65+
cucumber-gherkin (~> 18.1, >= 18.1.0)
66+
cucumber-messages (~> 15.0, >= 15.0.0)
67+
cucumber-tag-expressions (~> 3.0, >= 3.0.1)
68+
cucumber-create-meta (4.0.0)
69+
cucumber-messages (~> 15.0, >= 15.0.0)
70+
sys-uname (~> 1.2, >= 1.2.2)
71+
cucumber-cucumber-expressions (12.1.3)
72+
cucumber-gherkin (18.1.1)
73+
cucumber-messages (~> 15.0, >= 15.0.0)
74+
cucumber-html-formatter (13.0.0)
75+
cucumber-messages (~> 15.0, >= 15.0.0)
76+
cucumber-messages (15.0.0)
8377
protobuf-cucumber (~> 3.10, >= 3.10.8)
84-
cucumber-tag-expressions (2.0.4)
85-
cucumber-wire (3.1.0)
86-
cucumber-core (~> 7.1, >= 7.1.0)
87-
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
88-
cucumber-messages (~> 12.2, >= 12.2.0)
89-
diff-lcs (1.3)
78+
cucumber-tag-expressions (3.0.1)
79+
cucumber-wire (5.0.1)
80+
cucumber-core (~> 9.0, >= 9.0.1)
81+
cucumber-cucumber-expressions (~> 12.1, >= 12.1.1)
82+
cucumber-messages (~> 15.0, >= 15.0.0)
83+
diff-lcs (1.5.1)
9084
docile (1.4.0)
9185
ffi (1.15.5)
9286
ffi (1.15.5-java)
@@ -97,6 +91,9 @@ GEM
9791
matrix (0.4.2)
9892
method_source (1.0.0)
9993
middleware (0.1.0)
94+
mime-types (3.5.2)
95+
mime-types-data (~> 3.2015)
96+
mime-types-data (3.2024.0305)
10097
mini_mime (1.1.5)
10198
mini_portile2 (2.8.4)
10299
minitest (5.15.0)
@@ -161,10 +158,11 @@ GEM
161158
rubocop-ast (1.24.1)
162159
parser (>= 3.1.1.0)
163160
ruby-progressbar (1.11.0)
161+
simplecov-html (0.12.3)
164162
simplecov_json_formatter (0.1.3)
165163
spoon (0.0.6)
166164
ffi
167-
sys-uname (1.2.2)
165+
sys-uname (1.2.3)
168166
ffi (~> 1.1)
169167
test-unit (3.5.3)
170168
power_assert
@@ -190,20 +188,20 @@ PLATFORMS
190188
universal-java-1.8
191189

192190
DEPENDENCIES
191+
activesupport (~> 6.1)
193192
apparition!
194193
aruba (~> 1.0)
195194
benchmark-ips
196-
capybara (~> 3.31)
197-
cucumber (~> 4.0)
195+
capybara
196+
cucumber (~> 6.0)
198197
matrix
199198
minitest
200199
pry
201200
rackup
202-
rake (~> 13.0)
203-
rspec (~> 3.2)
201+
rake
202+
rspec
204203
rubocop
205204
simplecov!
206-
simplecov-html!
207205
test-unit
208206
webrick
209207

features/step_definitions/web_steps.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ def with_scope(locator)
4646

4747
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
4848
with_scope(selector) do
49-
expect(page).to have_no_content(text)
49+
expect(page).not_to have_content(text)
5050
end
5151
end
5252

5353
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
5454
regexp = Regexp.new(regexp)
5555
with_scope(selector) do
56-
expect(page).to have_no_xpath("//*", text: regexp)
56+
expect(page).not_to have_xpath("//*", text: regexp)
5757
end
5858
end
5959

@@ -65,7 +65,7 @@ def with_scope(locator)
6565
end
6666

6767
Then "{string} should not be visible" do |text|
68-
expect(page).to have_no_content(:visible, text)
68+
expect(page).not_to have_content(:visible, text)
6969
end
7070

7171
Then /^show me the page$/ do

lib/simplecov.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
# @see https://github.com/simplecov-ruby/simplecov/issues/86
1212
# @see https://jira.codehaus.org/browse/JRUBY-6106
1313

14-
warn 'Coverage may be inaccurate; set the "--debug" command line option,' \
15-
' or do JRUBY_OPTS="--debug"' \
16-
' or set the "debug.fullTrace=true" option in your .jrubyrc'
14+
warn 'Coverage may be inaccurate; set the "--debug" command line option, ' \
15+
'or do JRUBY_OPTS="--debug" ' \
16+
'or set the "debug.fullTrace=true" option in your .jrubyrc'
1717
end
1818

1919
#
@@ -48,8 +48,8 @@ class << self
4848
def start(profile = nil, &block)
4949
require "coverage"
5050
initial_setup(profile, &block)
51-
require_relative "./simplecov/process" if SimpleCov.enabled_for_subprocesses? &&
52-
::Process.respond_to?(:fork)
51+
require_relative "simplecov/process" if SimpleCov.enabled_for_subprocesses? &&
52+
::Process.respond_to?(:fork)
5353

5454
make_parallel_tests_available
5555

@@ -293,7 +293,7 @@ def write_last_run(result)
293293

294294
def initial_setup(profile, &block)
295295
load_profile(profile) if profile
296-
configure(&block) if block_given?
296+
configure(&block) if block
297297
self.running = true
298298
end
299299

@@ -339,9 +339,9 @@ def start_coverage_measurement
339339
end
340340

341341
def start_coverage_with_criteria
342-
start_arguments = coverage_criteria.map do |criterion|
342+
start_arguments = coverage_criteria.to_h do |criterion|
343343
[lookup_corresponding_ruby_coverage_name(criterion), true]
344-
end.to_h
344+
end
345345

346346
start_arguments[:eval] = true if coverage_for_eval_enabled?
347347

@@ -425,7 +425,7 @@ def make_parallel_tests_available
425425
end
426426

427427
def probably_running_parallel_tests?
428-
ENV["TEST_ENV_NUMBER"] && ENV["PARALLEL_TEST_GROUPS"]
428+
ENV.fetch("TEST_ENV_NUMBER", nil) && ENV.fetch("PARALLEL_TEST_GROUPS", nil)
429429
end
430430
end
431431
end

lib/simplecov/command_guesser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def from_env
2323
# If being run from inside parallel_tests set the command name according to the process number
2424
return unless ENV["PARALLEL_TEST_GROUPS"] && ENV["TEST_ENV_NUMBER"]
2525

26-
number = ENV["TEST_ENV_NUMBER"]
26+
number = ENV.fetch("TEST_ENV_NUMBER", nil)
2727
number = "1" if number.empty?
28-
"(#{number}/#{ENV['PARALLEL_TEST_GROUPS']})"
28+
"(#{number}/#{ENV.fetch('PARALLEL_TEST_GROUPS', nil)})"
2929
end
3030

3131
def from_command_line_options

lib/simplecov/configuration.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def coverage_dir(dir = nil)
3535
return @coverage_dir if defined?(@coverage_dir) && dir.nil?
3636

3737
@coverage_path = nil # invalidate cache
38-
@coverage_dir = (dir || "coverage")
38+
@coverage_dir = dir || "coverage"
3939
end
4040

4141
#
@@ -140,7 +140,7 @@ def print_error_status
140140
def nocov_token(nocov_token = nil)
141141
return @nocov_token if defined?(@nocov_token) && nocov_token.nil?
142142

143-
@nocov_token = (nocov_token || "nocov")
143+
@nocov_token = nocov_token || "nocov"
144144
end
145145
alias skip_token nocov_token
146146

@@ -191,9 +191,9 @@ def configure(&block)
191191
# end
192192
#
193193
def at_exit(&block)
194-
return Proc.new unless running || block_given?
194+
return Proc.new unless running || block
195195

196-
@at_exit = block if block_given?
196+
@at_exit = block if block
197197
@at_exit ||= proc { SimpleCov.result.format! }
198198
end
199199

@@ -231,7 +231,7 @@ def enabled_for_subprocesses?
231231
# end
232232
#
233233
def at_fork(&block)
234-
@at_fork = block if block_given?
234+
@at_fork = block if block
235235
@at_fork ||= lambda { |pid|
236236
# This needs a unique name so it won't be ovewritten
237237
SimpleCov.command_name "#{SimpleCov.command_name} (subprocess: #{pid})"
@@ -344,7 +344,7 @@ def minimum_coverage_by_file(coverage = nil)
344344
def refuse_coverage_drop(*criteria)
345345
criteria = coverage_criteria if criteria.empty?
346346

347-
maximum_coverage_drop(criteria.map { |c| [c, 0] }.to_h)
347+
maximum_coverage_drop(criteria.to_h { |c| [c, 0] })
348348
end
349349

350350
#

lib/simplecov/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
load filename
4545
rescue LoadError, StandardError
4646
warn "Warning: Error occurred while trying to load #{filename}. " \
47-
"Error message: #{$!.message}"
47+
"Error message: #{$!.message}"
4848
end
4949
break
5050
end

0 commit comments

Comments
 (0)