Skip to content

Commit

Permalink
Avoid hanging with parallel_tests
Browse files Browse the repository at this point in the history
ParallelTests.last_process? retuns true if the process is the last one to start.  We are
interested in the last test to finish so we want to use ParallelTests.number_of_running_processes

Because it's possible to have the parallel_tests gem in your project and still run tests serially we
want to also check if tests are currently being run in parallel.  If ENV['TEST_ENV_NUMBER'] is defined
we know tests are currently being run in parallel.
  • Loading branch information
annaswims authored and PragTob committed Sep 16, 2019
1 parent 60f8f95 commit 5e550da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/simplecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ def result_exit_status(result, covered_percent)
# @api private
#
def final_result_process?
!defined?(ParallelTests) || ParallelTests.last_process?
# checking for ENV["TEST_ENV_NUMBER"] to determine if the tess are being run in parallel
!defined?(ParallelTests) || !ENV["TEST_ENV_NUMBER"] || ParallelTests.number_of_running_processes <= 1
end

#
Expand Down

0 comments on commit 5e550da

Please sign in to comment.