mutineer 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +93 -0
- data/README.md +10 -4
- data/lib/mutineer/child_stdout.rb +35 -0
- data/lib/mutineer/coverage_map.rb +86 -47
- data/lib/mutineer/daemon_client.rb +1 -1
- data/lib/mutineer/daemon_server.rb +2 -1
- data/lib/mutineer/file_swap.rb +2 -0
- data/lib/mutineer/isolation.rb +8 -2
- data/lib/mutineer/minitest_integration/stop_at_first_failure.rb +199 -0
- data/lib/mutineer/minitest_integration.rb +30 -14
- data/lib/mutineer/mutant_id.rb +1 -1
- data/lib/mutineer/mutator_registry.rb +22 -9
- data/lib/mutineer/mutators/chain_link.rb +139 -0
- data/lib/mutineer/mutators/negation_removal.rb +44 -0
- data/lib/mutineer/mutators/range_literal.rb +54 -0
- data/lib/mutineer/mutators/safe_navigation.rb +76 -0
- data/lib/mutineer/runner.rb +2 -1
- data/lib/mutineer/test_runners/minitest.rb +5 -1
- data/lib/mutineer/test_runners/rspec.rb +9 -11
- data/lib/mutineer/test_runners.rb +4 -2
- data/lib/mutineer/version.rb +1 -1
- data/lib/mutineer.rb +4 -0
- metadata +7 -15
|
@@ -16,24 +16,22 @@ module Mutineer
|
|
|
16
16
|
# Runs the given RSpec files.
|
|
17
17
|
#
|
|
18
18
|
# @param spec_files [String, Array<String>] one file or many files.
|
|
19
|
+
# @param stop_at_first_failure [Boolean] when true, the run ends at the
|
|
20
|
+
# first failing example (RSpec `--fail-fast`).
|
|
19
21
|
# @return [Integer] 0 on success, 1 on failure.
|
|
20
|
-
def self.run(spec_files)
|
|
22
|
+
def self.run(spec_files, stop_at_first_failure: false)
|
|
21
23
|
require_rspec!
|
|
22
24
|
|
|
23
25
|
::RSpec::Core::Runner.disable_autorun!
|
|
24
26
|
::RSpec.reset
|
|
25
27
|
|
|
28
|
+
# The sink takes RSpec's own formatter output. Spec output is not
|
|
29
|
+
# silenced here: the fork boundary that calls this method has already
|
|
30
|
+
# pointed stdout at File::NULL (see ChildStdout).
|
|
26
31
|
sink = StringIO.new
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
$stderr = sink
|
|
31
|
-
begin
|
|
32
|
-
status = ::RSpec::Core::Runner.run(["--no-color", *Array(spec_files)], sink, sink)
|
|
33
|
-
ensure
|
|
34
|
-
$stdout = orig_out
|
|
35
|
-
$stderr = orig_err
|
|
36
|
-
end
|
|
32
|
+
args = ["--no-color"]
|
|
33
|
+
args << "--fail-fast" if stop_at_first_failure
|
|
34
|
+
status = ::RSpec::Core::Runner.run([*args, *Array(spec_files)], sink, sink)
|
|
37
35
|
|
|
38
36
|
status.zero? ? 0 : 1
|
|
39
37
|
end
|
|
@@ -6,8 +6,10 @@ require_relative "test_runners/rspec"
|
|
|
6
6
|
module Mutineer
|
|
7
7
|
# Picks the test-framework runner.
|
|
8
8
|
#
|
|
9
|
-
# Each runner responds to `.run(files) -> 0/1`
|
|
10
|
-
# failure) and is called only inside a forked child.
|
|
9
|
+
# Each runner responds to `.run(files, stop_at_first_failure: false) -> 0/1`
|
|
10
|
+
# (0 = all passed, 1 = any failure) and is called only inside a forked child.
|
|
11
|
+
# Only the mutant path passes `stop_at_first_failure: true`. The fork boundary
|
|
12
|
+
# silences stdout (see ChildStdout); the runners do not.
|
|
11
13
|
module TestRunners
|
|
12
14
|
# Returns the runner module for a framework name.
|
|
13
15
|
#
|
data/lib/mutineer/version.rb
CHANGED
data/lib/mutineer.rb
CHANGED
|
@@ -25,6 +25,10 @@ require_relative "mutineer/mutators/condition_negation"
|
|
|
25
25
|
require_relative "mutineer/mutators/string_literal"
|
|
26
26
|
require_relative "mutineer/mutators/regex_literal"
|
|
27
27
|
require_relative "mutineer/mutators/collection_method"
|
|
28
|
+
require_relative "mutineer/mutators/safe_navigation"
|
|
29
|
+
require_relative "mutineer/mutators/range_literal"
|
|
30
|
+
require_relative "mutineer/mutators/negation_removal"
|
|
31
|
+
require_relative "mutineer/mutators/chain_link"
|
|
28
32
|
require_relative "mutineer/mutator_registry"
|
|
29
33
|
require_relative "mutineer/worker_pool"
|
|
30
34
|
require_relative "mutineer/progress"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mutineer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Teren
|
|
@@ -9,20 +9,6 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: minitest
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - "~>"
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '5.0'
|
|
19
|
-
type: :development
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - "~>"
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '5.0'
|
|
26
12
|
- !ruby/object:Gem::Dependency
|
|
27
13
|
name: rake
|
|
28
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -68,6 +54,7 @@ files:
|
|
|
68
54
|
- lib/mutineer.rb
|
|
69
55
|
- lib/mutineer/baseline.rb
|
|
70
56
|
- lib/mutineer/changed_lines.rb
|
|
57
|
+
- lib/mutineer/child_stdout.rb
|
|
71
58
|
- lib/mutineer/cli.rb
|
|
72
59
|
- lib/mutineer/config.rb
|
|
73
60
|
- lib/mutineer/coverage_map.rb
|
|
@@ -78,6 +65,7 @@ files:
|
|
|
78
65
|
- lib/mutineer/file_swap.rb
|
|
79
66
|
- lib/mutineer/isolation.rb
|
|
80
67
|
- lib/mutineer/minitest_integration.rb
|
|
68
|
+
- lib/mutineer/minitest_integration/stop_at_first_failure.rb
|
|
81
69
|
- lib/mutineer/mutant_id.rb
|
|
82
70
|
- lib/mutineer/mutation.rb
|
|
83
71
|
- lib/mutineer/mutator_registry.rb
|
|
@@ -85,12 +73,16 @@ files:
|
|
|
85
73
|
- lib/mutineer/mutators/base.rb
|
|
86
74
|
- lib/mutineer/mutators/boolean_connector.rb
|
|
87
75
|
- lib/mutineer/mutators/boolean_literal.rb
|
|
76
|
+
- lib/mutineer/mutators/chain_link.rb
|
|
88
77
|
- lib/mutineer/mutators/collection_method.rb
|
|
89
78
|
- lib/mutineer/mutators/comparison.rb
|
|
90
79
|
- lib/mutineer/mutators/condition_negation.rb
|
|
91
80
|
- lib/mutineer/mutators/literal_mutation.rb
|
|
81
|
+
- lib/mutineer/mutators/negation_removal.rb
|
|
82
|
+
- lib/mutineer/mutators/range_literal.rb
|
|
92
83
|
- lib/mutineer/mutators/regex_literal.rb
|
|
93
84
|
- lib/mutineer/mutators/return_nil.rb
|
|
85
|
+
- lib/mutineer/mutators/safe_navigation.rb
|
|
94
86
|
- lib/mutineer/mutators/statement_removal.rb
|
|
95
87
|
- lib/mutineer/mutators/string_literal.rb
|
|
96
88
|
- lib/mutineer/pairing.rb
|