mutant 0.10.12 → 0.10.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mutant.rb +1 -1
- data/lib/mutant/cli/command/environment.rb +1 -1
- data/lib/mutant/config.rb +46 -8
- data/lib/mutant/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 561ad5a2483b3678f3bbcd3ab1ddbef3259f589548b59f3f42e993b76e50e120
|
4
|
+
data.tar.gz: dd3b79cbeb3bca13e502b9c43cbb59d2d3656e0f37905d5cbb33ac1e1ac98fb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d314dfd39fba6e6becf5d3410df2b6c95f94a5861df6446cb804b058edcad4d8b4a6ed98a6a21f4cfed3af48a450a17a3579b9b39e6814a60c4f10d746f77f9
|
7
|
+
data.tar.gz: 1ef113b288fca26803593efe136e2c8e49002eb6f33722373eaacf0276078ac6ac4624139c10636498cf2e9c5eec8c64512b08796833380f457e5f1497bcab61
|
data/lib/mutant.rb
CHANGED
@@ -226,7 +226,7 @@ module Mutant
|
|
226
226
|
# Reopen class to initialize constant to avoid dep circle
|
227
227
|
class Config
|
228
228
|
DEFAULT = new(
|
229
|
-
coverage_criteria: Config::CoverageCriteria::
|
229
|
+
coverage_criteria: Config::CoverageCriteria::EMPTY,
|
230
230
|
expression_parser: Expression::Parser.new([
|
231
231
|
Expression::Method,
|
232
232
|
Expression::Methods,
|
data/lib/mutant/config.rb
CHANGED
@@ -40,6 +40,12 @@ module Mutant
|
|
40
40
|
class CoverageCriteria
|
41
41
|
include Anima.new(:process_abort, :test_result, :timeout)
|
42
42
|
|
43
|
+
EMPTY = new(
|
44
|
+
process_abort: nil,
|
45
|
+
test_result: nil,
|
46
|
+
timeout: nil
|
47
|
+
)
|
48
|
+
|
43
49
|
DEFAULT = new(
|
44
50
|
process_abort: false,
|
45
51
|
test_result: true,
|
@@ -61,6 +67,22 @@ module Mutant
|
|
61
67
|
->(value) { Either::Right.new(DEFAULT.with(**value)) }
|
62
68
|
]
|
63
69
|
)
|
70
|
+
|
71
|
+
def merge(other)
|
72
|
+
self.class.new(
|
73
|
+
process_abort: overwrite(other, :process_abort),
|
74
|
+
test_result: overwrite(other, :test_result),
|
75
|
+
timeout: overwrite(other, :timeout)
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def overwrite(other, attribute_name)
|
82
|
+
other_value = other.public_send(attribute_name)
|
83
|
+
|
84
|
+
other_value.nil? ? public_send(attribute_name) : other_value
|
85
|
+
end
|
64
86
|
end # CoverageCriteria
|
65
87
|
|
66
88
|
# Merge with other config
|
@@ -68,18 +90,24 @@ module Mutant
|
|
68
90
|
# @param [Config] other
|
69
91
|
#
|
70
92
|
# @return [Config]
|
93
|
+
#
|
94
|
+
# rubocop:disable Metrics/AbcSize
|
95
|
+
# rubocop:disable Metrics/MethodLength
|
71
96
|
def merge(other)
|
72
97
|
other.with(
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
98
|
+
coverage_criteria: coverage_criteria.merge(other.coverage_criteria),
|
99
|
+
fail_fast: fail_fast || other.fail_fast,
|
100
|
+
includes: includes + other.includes,
|
101
|
+
jobs: other.jobs || jobs,
|
102
|
+
integration: other.integration || integration,
|
103
|
+
mutation_timeout: other.mutation_timeout || mutation_timeout,
|
104
|
+
matcher: matcher.merge(other.matcher),
|
105
|
+
requires: requires + other.requires,
|
106
|
+
zombie: zombie || other.zombie
|
81
107
|
)
|
82
108
|
end
|
109
|
+
# rubocop:enable Metrics/AbcSize
|
110
|
+
# rubocop:enable Metrics/MethodLength
|
83
111
|
|
84
112
|
# Load config file
|
85
113
|
#
|
@@ -100,6 +128,16 @@ module Mutant
|
|
100
128
|
end
|
101
129
|
end
|
102
130
|
|
131
|
+
# Expand config with defaults
|
132
|
+
#
|
133
|
+
# @return [Config]
|
134
|
+
def expand_defaults
|
135
|
+
with(
|
136
|
+
coverage_criteria: CoverageCriteria::DEFAULT.merge(coverage_criteria),
|
137
|
+
jobs: jobs || 1
|
138
|
+
)
|
139
|
+
end
|
140
|
+
|
103
141
|
def self.load_contents(path)
|
104
142
|
Transform::Named
|
105
143
|
.new(path.to_s, TRANSFORM)
|
data/lib/mutant/version.rb
CHANGED