Skip to content

Commit a8eb40f

Browse files
pftgclaude
andcommitted
refactor: avoid double finalize call for Minitest
Restore if/else — Minitest.after_run when Minitest is loaded, at_exit otherwise. Nobody runs Minitest and RSpec in the same process, so the @Finalized double-execution guard is unnecessary overhead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9e7566d commit a8eb40f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • lib/capybara_screenshot_diff/reporters

lib/capybara_screenshot_diff/reporters/html.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def write_report
147147
end
148148
end
149149

150-
# Always register at_exit for RSpec/Cucumber/other frameworks.
151-
# Additionally register Minitest.after_run for correct ordering with Minitest.
152-
# The @finalized guard in #finalize prevents double execution.
153-
at_exit(&snap_diff_finalize)
154-
Minitest.after_run(&snap_diff_finalize) if defined?(Minitest) && Minitest.respond_to?(:after_run)
150+
if defined?(Minitest) && Minitest.respond_to?(:after_run)
151+
Minitest.after_run(&snap_diff_finalize)
152+
else
153+
at_exit(&snap_diff_finalize)
154+
end

0 commit comments

Comments
 (0)