diff --git a/test/test_helper.rb b/test/test_helper.rb index 8cd6b9e7..224e9db2 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -21,6 +21,13 @@ def Hash.ruby2_keywords_hash?(_hash) require "sorbet-runtime" if RUBY_VERSION >= "3.0" +require "timeout" + +# `Timeout` starts one thread for the whole process on first use and keeps it. Start it before any test runs: +# tests that compare `Thread.list` before and after a step would otherwise take it for a thread the step left behind, +# whenever they happen to be the first to use it. +Timeout.timeout(1) { nil } + require_relative "instrumentation_test_helper" require_relative "initialize_params_test_helper"