Class: Evilution::Integration::RSpec::ResultBuilder
- Inherits:
-
Object
- Object
- Evilution::Integration::RSpec::ResultBuilder
- Defined in:
- lib/evilution/integration/rspec/result_builder.rb
Instance Method Summary collapse
- #from_run(status, command, detector, examples_loaded: nil) ⇒ Object
- #unresolved(mutation) ⇒ Object
- #unresolved_example(mutation) ⇒ Object
Instance Method Details
#from_run(status, command, detector, examples_loaded: nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/evilution/integration/rspec/result_builder.rb', line 24 def from_run(status, command, detector, examples_loaded: nil) return { passed: true, test_command: command } if status.zero? if detector.only_crashes? classes = detector.unique_crash_classes return { passed: false, test_crashed: true, error: "test crashes: #{detector.crash_summary}", error_class: (classes.first if classes.length == 1), test_command: command } end # Nonzero exit + zero examples loaded = the spec file did not register any # examples (load error, autoload mismatch, etc.), so nothing ran against # the mutation. Surfacing this as a generic fail would let classify_status # fall through to its :killed default and silently inflate the kill count # even though no example ever observed the mutation (EV-720r: macOS Rails # users hit autoload / fail_if_no_examples paths that yielded killed=100% # with empty worker output). Note: this checks LOADED count, not executed # count — filters/skip/--fail-fast can leave loaded > executed, but the # "spec failed to load entirely" case is the failure mode this guard targets. if !examples_loaded.nil? && examples_loaded.zero? return { passed: false, error: "RSpec exited #{status} but loaded 0 examples — no examples ran against the mutation. " \ "Likely the spec file failed to load, --spec was misrouted, or RSpec is configured " \ "with fail_if_no_examples. The mutation cannot be counted as killed.", test_command: command } end { passed: false, test_command: command } end |
#unresolved(mutation) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/evilution/integration/rspec/result_builder.rb', line 6 def unresolved(mutation) { passed: false, unresolved: true, error: "no matching spec resolved for #{mutation.file_path}", test_command: "rspec (skipped: no spec resolved for #{mutation.file_path})" } end |
#unresolved_example(mutation) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/evilution/integration/rspec/result_builder.rb', line 15 def unresolved_example(mutation) { passed: false, unresolved: true, error: "no matching example found for #{mutation.file_path}", test_command: "rspec (skipped: no matching example for #{mutation.file_path})" } end |