lib/rspec_tracer/configuration.rb in rspec-tracer-0.9.3 vs lib/rspec_tracer/configuration.rb in rspec-tracer-1.0.0

- old
+ new

@@ -29,11 +29,12 @@ end def cache_path @cache_path ||= begin cache_path = File.expand_path(cache_dir, root) - cache_path = File.join(cache_path, ENV['TEST_SUITE_ID'].to_s) + cache_path = File.join(cache_path, ENV['TEST_SUITE_ID'].to_s) if ENV['TEST_SUITE_ID'] + cache_path = File.join(cache_path, parallel_tests_id) if RSpecTracer.parallel_tests? FileUtils.mkdir_p(cache_path) cache_path end @@ -44,11 +45,12 @@ end def report_path @report_path ||= begin report_path = File.expand_path(report_dir, root) - report_path = File.join(report_path, ENV['TEST_SUITE_ID'].to_s) + report_path = File.join(report_path, ENV['TEST_SUITE_ID'].to_s) if ENV['TEST_SUITE_ID'] + report_path = File.join(report_path, parallel_tests_id) if RSpecTracer.parallel_tests? FileUtils.mkdir_p(report_path) report_path end @@ -59,11 +61,12 @@ end def coverage_path @coverage_path ||= begin coverage_path = File.expand_path(coverage_dir, root) - coverage_path = File.join(coverage_path, ENV['TEST_SUITE_ID'].to_s) + coverage_path = File.join(coverage_path, ENV['TEST_SUITE_ID'].to_s) if ENV['TEST_SUITE_ID'] + coverage_path = File.join(coverage_path, parallel_tests_id) if RSpecTracer.parallel_tests? FileUtils.mkdir_p(coverage_path) coverage_path end @@ -91,25 +94,29 @@ def coverage_filters @coverage_filters ||= [] end + def parallel_tests_lock_file + '/tmp/parallel_tests.lock' + end + def verbose? @verbose ||= (ENV.fetch('RSPEC_TRACER_VERBOSE', 'false') == 'true') end def configure(&block) Docile.dsl_eval(self, &block) end private - def test_suite_id - suite_id = ENV.fetch('TEST_SUITE_ID', '') - - return if suite_id.empty? - - suite_id + def parallel_tests_id + if ParallelTests.first_process? + 'parallel_tests_1' + else + "parallel_tests_#{ENV['TEST_ENV_NUMBER']}" + end end def at_exit(&block) return Proc.new unless RSpecTracer.running || block