Skip to content

Commit 637043a

Browse files
committed
🧑‍💻 Make conditions less confusing using short circuit return statements
1 parent a49f7fe commit 637043a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/simplecov.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,20 @@ def result_exit_status(result)
267267
#
268268
def final_result_process?
269269
# checking for ENV["TEST_ENV_NUMBER"] to determine if the tests are being run in parallel
270-
!ENV["TEST_ENV_NUMBER"] || (defined?(ParallelTests) && ParallelTests.last_process?)
270+
# Short circuit if not parallel
271+
return false unless ENV["TEST_ENV_NUMBER"]
272+
273+
make_parallel_tests_available
274+
return false unless defined?(ParallelTests)
275+
276+
ParallelTests.last_process?
271277
end
272278

273279
#
274280
# @api private
275281
#
276282
def wait_for_other_processes
277-
return unless defined?(ParallelTests) && final_result_process?
283+
return unless final_result_process?
278284

279285
ParallelTests.wait_for_other_processes_to_finish
280286
end

0 commit comments

Comments
 (0)