Skip to content

Commit f46743a

Browse files
hsbtclaude
authored andcommitted
[ruby/rubygems] Move SimpleCov setup before test-unit to fix at_exit ordering
SimpleCov and test-unit both use at_exit hooks, which Ruby executes in LIFO order. When SimpleCov was loaded after test-unit, its at_exit hook fired first — before tests had run — producing a spurious "Coverage report generated" message from stale results. Moving SimpleCov setup before test-unit ensures its at_exit hook is registered first and therefore runs last, after tests have completed. ruby/rubygems@47e1c347e8 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7c8762a commit f46743a

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

test/rubygems/helper.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
require "rubygems"
44

5-
begin
6-
gem "test-unit", "~> 3.0"
7-
rescue Gem::LoadError
8-
end
9-
10-
require "test/unit"
11-
125
begin
136
raise LoadError if ENV["GEM_COMMAND"]
147

@@ -35,6 +28,13 @@
3528
# SimpleCov is not installed
3629
end
3730

31+
begin
32+
gem "test-unit", "~> 3.0"
33+
rescue Gem::LoadError
34+
end
35+
36+
require "test/unit"
37+
3838
require "fileutils"
3939
require "pathname"
4040
require "pp"

0 commit comments

Comments
 (0)