mutant 0.11.20 → 0.11.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mutant/ast/meta/send.rb +1 -2
- data/lib/mutant/cli/command/environment.rb +17 -3
- data/lib/mutant/config.rb +36 -7
- data/lib/mutant/env.rb +3 -0
- data/lib/mutant/integration.rb +35 -6
- data/lib/mutant/isolation/fork.rb +0 -4
- data/lib/mutant/matcher/filter.rb +1 -3
- data/lib/mutant/reporter/cli/printer/config.rb +1 -1
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47d87c7b5cf12da4906d170d892be1d5121b4f65b86b39365db2d6424f1487c6
|
4
|
+
data.tar.gz: e8d9007fc9633eea5343b83282d331fab5e59aaf6f880aa9b52cb525b2f6db81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04e36404f3a210cfa4a7045e244a72509e69332dbf736e81f5069a7d632680931747b761fd5f61e2ba915e94a0f9545506c3db2369a44f62a21b7a0254264db6
|
7
|
+
data.tar.gz: 2e0db7e6d2ada9525ec054a197f8004e223a31c093ab7b603704044f92f8e1f4305048851b8a583172f3904a028a25a304a605e3e84d5a5e708eccabb6842e9c
|
data/lib/mutant/ast/meta/send.rb
CHANGED
@@ -33,8 +33,7 @@ module Mutant
|
|
33
33
|
#
|
34
34
|
# @return [Boolean]
|
35
35
|
def attribute_assignment?
|
36
|
-
!Types::METHOD_OPERATORS.include?(selector) &&
|
37
|
-
selector.to_s.end_with?(ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX)
|
36
|
+
!Types::METHOD_OPERATORS.include?(selector) && selector.end_with?(ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX)
|
38
37
|
end
|
39
38
|
|
40
39
|
# Test for binary operator implemented as method
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module Mutant
|
4
4
|
module CLI
|
5
5
|
class Command
|
6
|
+
# rubocop:disable Metrics/ClassLength
|
6
7
|
class Environment < self
|
7
8
|
NAME = 'environment'
|
8
9
|
SHORT_DESCRIPTION = 'Environment subcommands'
|
@@ -87,9 +88,22 @@ module Mutant
|
|
87
88
|
def add_integration_options(parser)
|
88
89
|
parser.separator('Integration:')
|
89
90
|
|
90
|
-
parser.on('--use INTEGRATION', '
|
91
|
-
|
92
|
-
|
91
|
+
parser.on('--use INTEGRATION', 'deprecated alias for --integration', &method(:assign_integration_name))
|
92
|
+
parser.on('--integration NAME', 'Use test integration with NAME', &method(:assign_integration_name))
|
93
|
+
|
94
|
+
parser.on(
|
95
|
+
'--integration-argument ARGUMENT', 'Pass ARGUMENT to integration',
|
96
|
+
&method(:add_integration_argument)
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
def add_integration_argument(value)
|
101
|
+
config = @config.integration
|
102
|
+
set(integration: config.with(arguments: config.arguments + [value]))
|
103
|
+
end
|
104
|
+
|
105
|
+
def assign_integration_name(name)
|
106
|
+
set(integration: @config.integration.with(name: name))
|
93
107
|
end
|
94
108
|
|
95
109
|
def add_matcher_options(parser)
|
data/lib/mutant/config.rb
CHANGED
@@ -52,6 +52,20 @@ module Mutant
|
|
52
52
|
```
|
53
53
|
MESSAGE
|
54
54
|
|
55
|
+
INTEGRATION_DEPRECATION = <<~'MESSAGE'
|
56
|
+
Deprecated configuration toplevel string key `integration` found.
|
57
|
+
|
58
|
+
This key will be removed in the next major version.
|
59
|
+
Instead place your integration configuration under the `integration.name` key
|
60
|
+
like this:
|
61
|
+
|
62
|
+
```
|
63
|
+
# mutant.yml
|
64
|
+
integration:
|
65
|
+
name: your_integration # typically rspec or minitest
|
66
|
+
```
|
67
|
+
MESSAGE
|
68
|
+
|
55
69
|
private_constant(*constants(false))
|
56
70
|
|
57
71
|
# Merge with other config
|
@@ -69,7 +83,7 @@ module Mutant
|
|
69
83
|
fail_fast: fail_fast || other.fail_fast,
|
70
84
|
hooks: hooks + other.hooks,
|
71
85
|
includes: includes + other.includes,
|
72
|
-
integration: other.integration
|
86
|
+
integration: integration.merge(other.integration),
|
73
87
|
jobs: other.jobs || jobs,
|
74
88
|
matcher: matcher.merge(other.matcher),
|
75
89
|
mutation: mutation.merge(other.mutation),
|
@@ -158,14 +172,29 @@ module Mutant
|
|
158
172
|
end
|
159
173
|
|
160
174
|
def self.deprecations(reporter, hash)
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
(hash['mutation'] ||= {})['timeout'] ||= hash.delete('mutation_timeout')
|
165
|
-
end
|
175
|
+
mutation_timeout_deprecation(reporter, hash)
|
176
|
+
integration_deprecation(reporter, hash)
|
166
177
|
|
167
178
|
hash
|
168
179
|
end
|
180
|
+
private_class_method :deprecations
|
181
|
+
|
182
|
+
def self.mutation_timeout_deprecation(reporter, hash)
|
183
|
+
return unless hash.key?('mutation_timeout')
|
184
|
+
reporter.warn(MUTATION_TIMEOUT_DEPRECATION)
|
185
|
+
|
186
|
+
(hash['mutation'] ||= {})['timeout'] ||= hash.delete('mutation_timeout')
|
187
|
+
end
|
188
|
+
private_class_method :mutation_timeout_deprecation
|
189
|
+
|
190
|
+
def self.integration_deprecation(reporter, hash)
|
191
|
+
value = hash['integration']
|
192
|
+
return unless value.instance_of?(String)
|
193
|
+
reporter.warn(INTEGRATION_DEPRECATION)
|
194
|
+
|
195
|
+
hash['integration'] = { 'name' => value }
|
196
|
+
end
|
197
|
+
private_class_method :integration_deprecation
|
169
198
|
|
170
199
|
TRANSFORMS = [
|
171
200
|
Transform::Hash.new(
|
@@ -196,7 +225,7 @@ module Mutant
|
|
196
225
|
value: 'includes'
|
197
226
|
),
|
198
227
|
Transform::Hash::Key.new(
|
199
|
-
transform:
|
228
|
+
transform: ->(value) { Integration::Config::TRANSFORM.call(value) },
|
200
229
|
value: 'integration'
|
201
230
|
),
|
202
231
|
Transform::Hash::Key.new(
|
data/lib/mutant/env.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
module Mutant
|
4
4
|
# Mutation testing execution environment
|
5
|
+
# rubocop:disable Metrics/ClassLength
|
5
6
|
class Env
|
6
7
|
include Adamantium, Anima.new(
|
7
8
|
:config,
|
@@ -32,6 +33,7 @@ module Mutant
|
|
32
33
|
config: config,
|
33
34
|
hooks: Hooks.empty,
|
34
35
|
integration: Integration::Null.new(
|
36
|
+
arguments: EMPTY_ARRAY,
|
35
37
|
expression_parser: config.expression_parser,
|
36
38
|
world: world
|
37
39
|
),
|
@@ -175,4 +177,5 @@ module Mutant
|
|
175
177
|
end
|
176
178
|
|
177
179
|
end # Env
|
180
|
+
# rubocop:enable Metrics/ClassLength
|
178
181
|
end # Mutant
|
data/lib/mutant/integration.rb
CHANGED
@@ -4,7 +4,7 @@ module Mutant
|
|
4
4
|
|
5
5
|
# Abstract base class mutant test framework integrations
|
6
6
|
class Integration
|
7
|
-
include AbstractType, Adamantium, Anima.new(:expression_parser, :world)
|
7
|
+
include AbstractType, Adamantium, Anima.new(:arguments, :expression_parser, :world)
|
8
8
|
|
9
9
|
LOAD_MESSAGE = <<~'MESSAGE'
|
10
10
|
Unable to load integration mutant-%<integration_name>s:
|
@@ -26,18 +26,47 @@ module Mutant
|
|
26
26
|
|
27
27
|
private_constant(*constants(false))
|
28
28
|
|
29
|
+
class Config
|
30
|
+
include Adamantium, Anima.new(:name, :arguments)
|
31
|
+
|
32
|
+
DEFAULT = new(arguments: EMPTY_ARRAY, name: nil)
|
33
|
+
|
34
|
+
TRANSFORM = Transform::Sequence.new(
|
35
|
+
steps: [
|
36
|
+
Transform::Primitive.new(primitive: Hash),
|
37
|
+
Transform::Hash.new(
|
38
|
+
optional: [
|
39
|
+
Transform::Hash::Key.new(transform: Transform::STRING, value: 'name'),
|
40
|
+
Transform::Hash::Key.new(transform: Transform::STRING_ARRAY, value: 'arguments')
|
41
|
+
],
|
42
|
+
required: []
|
43
|
+
),
|
44
|
+
Transform::Hash::Symbolize.new,
|
45
|
+
Transform::Success.new(block: DEFAULT.method(:with))
|
46
|
+
]
|
47
|
+
)
|
48
|
+
|
49
|
+
def merge(other)
|
50
|
+
self.class.new(
|
51
|
+
name: other.name || name,
|
52
|
+
arguments: arguments + other.arguments
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end # Config
|
56
|
+
|
29
57
|
# Setup integration
|
30
58
|
#
|
31
59
|
# @param env [Bootstrap]
|
32
60
|
#
|
33
61
|
# @return [Either<String, Integration>]
|
34
62
|
def self.setup(env)
|
35
|
-
|
36
|
-
|
37
|
-
|
63
|
+
integration_config = env.config.integration
|
64
|
+
|
65
|
+
return Either::Left.new(INTEGRATION_MISSING) unless integration_config.name
|
38
66
|
|
39
67
|
attempt_require(env).bind { attempt_const_get(env) }.fmap do |klass|
|
40
68
|
klass.new(
|
69
|
+
arguments: integration_config.arguments,
|
41
70
|
expression_parser: env.config.expression_parser,
|
42
71
|
world: env.world
|
43
72
|
).setup
|
@@ -46,7 +75,7 @@ module Mutant
|
|
46
75
|
|
47
76
|
# rubocop:disable Style/MultilineBlockChain
|
48
77
|
def self.attempt_require(env)
|
49
|
-
integration_name = env.config.integration
|
78
|
+
integration_name = env.config.integration.name
|
50
79
|
|
51
80
|
Either.wrap_error(LoadError) do
|
52
81
|
env.world.kernel.require("mutant/integration/#{integration_name}")
|
@@ -61,7 +90,7 @@ module Mutant
|
|
61
90
|
# rubocop:enable Style/MultilineBlockChain
|
62
91
|
|
63
92
|
def self.attempt_const_get(env)
|
64
|
-
integration_name = env.config.integration
|
93
|
+
integration_name = env.config.integration.name
|
65
94
|
constant_name = integration_name.capitalize
|
66
95
|
|
67
96
|
Either.wrap_error(NameError) { const_get(constant_name) }.lmap do |exception|
|
@@ -205,10 +205,6 @@ module Mutant
|
|
205
205
|
_pid, status = world.process.wait2(@pid, Process::WNOHANG)
|
206
206
|
status
|
207
207
|
end
|
208
|
-
|
209
|
-
def add_result(result)
|
210
|
-
@result = defined?(@result) ? @result.add_error(result) : result
|
211
|
-
end
|
212
208
|
end # Parent
|
213
209
|
# rubocop:enable Metrics/ClassLength
|
214
210
|
|
@@ -16,7 +16,7 @@ module Mutant
|
|
16
16
|
# rubocop:disable Metrics/AbcSize
|
17
17
|
def run
|
18
18
|
info 'Matcher: %s', object.matcher.inspect
|
19
|
-
info 'Integration: %s', object.integration || 'null'
|
19
|
+
info 'Integration: %s', object.integration.name || 'null'
|
20
20
|
info 'Jobs: %s', object.jobs || 'auto'
|
21
21
|
info 'Includes: %s', object.includes
|
22
22
|
info 'Requires: %s', object.requires
|
data/lib/mutant/version.rb
CHANGED
data/lib/mutant.rb
CHANGED
@@ -346,7 +346,7 @@ module Mutant
|
|
346
346
|
fail_fast: false,
|
347
347
|
hooks: EMPTY_ARRAY,
|
348
348
|
includes: EMPTY_ARRAY,
|
349
|
-
integration:
|
349
|
+
integration: Integration::Config::DEFAULT,
|
350
350
|
isolation: Mutant::Isolation::Fork.new(world: WORLD),
|
351
351
|
jobs: nil,
|
352
352
|
matcher: Matcher::Config::DEFAULT,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.6.
|
75
|
+
version: 0.6.8
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.6.
|
82
|
+
version: 0.6.8
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: parallel
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|