Module: Evilution
- Defined in:
- lib/evilution.rb,
lib/evilution/version.rb
Defined Under Namespace
Modules: AST, ChildOutput, Compare, Equivalent, Feedback, GemDetector, Git, Integration, Isolation, LoadPath, MCP, Memory, Mutator, Parallel, ParallelDbWarning, ProcessCleanup, RailsDetector, Reporter, Result, Session, TempDirTracker Classes: Baseline, CLI, Cache, Config, ConfigError, DisableComment, Error, ExampleFilter, Hooks, IsolationError, Mutation, ParseError, RelatedSpecHeuristic, Runner, SourceAstCache, SpecAstCache, SpecResolver, SpecSelector, Subject
Constant Summary collapse
- PROJECT_ROOT =
Captured at load time, before any isolator can chdir into a per-mutation sandbox. Used as the anchor for resolving project-relative paths (spec files, source files for eval) from inside a chdir’d child so the CWD sandbox (EV-wqxu / GH #1278) cannot break spec resolution or eval __FILE__.
Dir.pwd.freeze
- VERSION =
"0.32.0"
Class Method Summary collapse
-
.in_isolated_worker! ⇒ Object
Flag set by isolators (Evilution::Isolation::Fork in the forked child, Evilution::Isolation::InProcess around the test_command) so spec resolution and source eval anchor relative paths to PROJECT_ROOT instead of Dir.pwd.
- .in_isolated_worker? ⇒ Boolean
-
.project_base_dir ⇒ Object
Base directory for resolving project-relative paths.
- .with_isolated_worker ⇒ Object
Class Method Details
.in_isolated_worker! ⇒ Object
Flag set by isolators (Evilution::Isolation::Fork in the forked child, Evilution::Isolation::InProcess around the test_command) so spec resolution and source eval anchor relative paths to PROJECT_ROOT instead of Dir.pwd. Without this gate, a caller that intentionally chdirs to a different project (e.g. a fixture layout in tests) would have its lookups inadvertently fall back to the evilution dev tree.
144 145 146 |
# File 'lib/evilution.rb', line 144 def self.in_isolated_worker! @in_isolated_worker = true end |
.in_isolated_worker? ⇒ Boolean
148 149 150 |
# File 'lib/evilution.rb', line 148 def self.in_isolated_worker? @in_isolated_worker == true end |
.project_base_dir ⇒ Object
Base directory for resolving project-relative paths. An isolated worker has chdir’d into a per-mutation sandbox (EV-wqxu / GH #1278), so callers in that context must anchor against PROJECT_ROOT rather than Dir.pwd —otherwise spec files, source eval __FILE__, and $LOAD_PATH entries resolve into the sandbox and break the run. In any other context (normal use, tests that intentionally chdir into a fixture project layout, etc.) the caller’s Dir.pwd remains the truth.
167 168 169 |
# File 'lib/evilution.rb', line 167 def self.project_base_dir in_isolated_worker? ? PROJECT_ROOT : Dir.pwd end |
.with_isolated_worker ⇒ Object
152 153 154 155 156 157 158 |
# File 'lib/evilution.rb', line 152 def self.with_isolated_worker previous = @in_isolated_worker @in_isolated_worker = true yield ensure @in_isolated_worker = previous end |