Module: RSpecTurbo::Config
- Defined in:
- lib/rspec_turbo/config.rb
Overview
Central place for environment-driven settings and derived log paths.
All tuning happens through environment variables so the runner stays a single zero-config binary:
RSPEC_TURBO_MAX number of parallel workers (default: nproc)
RSPEC_TURBO_LOG_DIR where per-worker logs live
RSPEC_TURBO_FORCE_SETUP=1 recreate test DBs even if cached
RSPEC_TURBO_PROGRESS_INTERVAL seconds between CI progress lines
COVERAGE=1 merge SimpleCov results after the run
JUNIT_DIR=path emit JUnit XML per worker into this dir
Slow-test profiling is opt-in and feeds the “Slowest folders/files” report (see slow_profile.rb): RSPEC_PROFILE_SLOW=1, RSPEC_PROFILE_GROUP_BY, etc.
Constant Summary collapse
- TTY =
$stdout.tty? && !ENV["CI"]
Class Method Summary collapse
- .coverage? ⇒ Boolean
- .coverage_merge_log ⇒ Object
- .dry_run_log ⇒ Object
- .force_setup? ⇒ Boolean
- .junit_dir ⇒ Object
-
.log_dir ⇒ Object
── Derived paths ──────────────────────────────────────────────────────.
- .log_path(label) ⇒ Object
-
.profile? ⇒ Boolean
Slow-test profiling is on by default; RSPEC_TURBO_NO_PROFILE=1 is the master kill switch.
- .progress_interval ⇒ Object
- .progress_path(slot) ⇒ Object
- .setup_log_path(slot) ⇒ Object
- .setup_marker_dir ⇒ Object
- .tty? ⇒ Boolean
- .workers ⇒ Object
Class Method Details
.coverage? ⇒ Boolean
39 |
# File 'lib/rspec_turbo/config.rb', line 39 def coverage? = %w[1 true].include?(ENV.fetch("COVERAGE", "0").downcase) |
.coverage_merge_log ⇒ Object
61 |
# File 'lib/rspec_turbo/config.rb', line 61 def coverage_merge_log = File.join(log_dir, "coverage_merge.log") |
.dry_run_log ⇒ Object
59 |
# File 'lib/rspec_turbo/config.rb', line 59 def dry_run_log = File.join(log_dir, "dry_run_stderr.log") |
.force_setup? ⇒ Boolean
31 32 33 34 35 |
# File 'lib/rspec_turbo/config.rb', line 31 def force_setup? flag = ENV["RSPEC_TURBO_FORCE_SETUP"] || ENV["RSPEC_PARALLEL_FORCE_SETUP"] %w[1 true yes].include?(flag.to_s.downcase) end |
.junit_dir ⇒ Object
41 |
# File 'lib/rspec_turbo/config.rb', line 41 def junit_dir = ENV["JUNIT_DIR"] |
.log_dir ⇒ Object
── Derived paths ──────────────────────────────────────────────────────
49 |
# File 'lib/rspec_turbo/config.rb', line 49 def log_dir = ENV.fetch("RSPEC_TURBO_LOG_DIR") { ENV.fetch("RSPEC_LOG_DIR", "tmp/rspec-turbo") } |
.log_path(label) ⇒ Object
53 |
# File 'lib/rspec_turbo/config.rb', line 53 def log_path(label) = File.join(log_dir, "#{label.tr("/", "_")}.log") |
.profile? ⇒ Boolean
Slow-test profiling is on by default; RSPEC_TURBO_NO_PROFILE=1 is the master kill switch. See slow_profile.rb and Worker.profile_env.
45 |
# File 'lib/rspec_turbo/config.rb', line 45 def profile? = !%w[1 true yes].include?(ENV["RSPEC_TURBO_NO_PROFILE"].to_s.downcase) |
.progress_interval ⇒ Object
37 |
# File 'lib/rspec_turbo/config.rb', line 37 def progress_interval = Integer(ENV.fetch("RSPEC_TURBO_PROGRESS_INTERVAL", "30")) |
.progress_path(slot) ⇒ Object
55 |
# File 'lib/rspec_turbo/config.rb', line 55 def progress_path(slot) = File.join(log_dir, "progress_#{slot}.txt") |
.setup_log_path(slot) ⇒ Object
57 |
# File 'lib/rspec_turbo/config.rb', line 57 def setup_log_path(slot) = File.join(log_dir, "setup_slot#{slot}.log") |
.setup_marker_dir ⇒ Object
51 |
# File 'lib/rspec_turbo/config.rb', line 51 def setup_marker_dir = File.join(log_dir, "setup") |
.workers ⇒ Object
27 28 29 |
# File 'lib/rspec_turbo/config.rb', line 27 def workers Integer(ENV.fetch("RSPEC_TURBO_MAX") { ENV.fetch("RSPEC_PARALLEL_MAX", Etc.nprocessors) }) end |