mutant 0.6.7 → 0.7.1

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +10 -0
  3. data/README.md +1 -1
  4. data/config/flay.yml +1 -1
  5. data/config/reek.yml +11 -40
  6. data/config/rubocop.yml +1 -1
  7. data/lib/mutant.rb +10 -2
  8. data/lib/mutant/actor.rb +64 -0
  9. data/lib/mutant/actor/actor.rb +50 -0
  10. data/lib/mutant/actor/env.rb +35 -0
  11. data/lib/mutant/actor/mailbox.rb +53 -0
  12. data/lib/mutant/actor/receiver.rb +48 -0
  13. data/lib/mutant/actor/sender.rb +27 -0
  14. data/lib/mutant/ast/types.rb +1 -1
  15. data/lib/mutant/cli.rb +2 -0
  16. data/lib/mutant/config.rb +2 -1
  17. data/lib/mutant/env.rb +6 -2
  18. data/lib/mutant/expression/methods.rb +1 -1
  19. data/lib/mutant/integration.rb +11 -1
  20. data/lib/mutant/isolation.rb +1 -2
  21. data/lib/mutant/meta/example.rb +1 -1
  22. data/lib/mutant/mutation.rb +47 -21
  23. data/lib/mutant/mutator/node.rb +1 -1
  24. data/lib/mutant/mutator/node/literal/symbol.rb +1 -1
  25. data/lib/mutant/mutator/node/send.rb +4 -3
  26. data/lib/mutant/reporter/cli.rb +2 -0
  27. data/lib/mutant/reporter/cli/format.rb +23 -36
  28. data/lib/mutant/reporter/cli/printer.rb +66 -27
  29. data/lib/mutant/result.rb +45 -58
  30. data/lib/mutant/runner.rb +47 -154
  31. data/lib/mutant/runner/master.rb +174 -0
  32. data/lib/mutant/runner/scheduler.rb +141 -0
  33. data/lib/mutant/runner/worker.rb +93 -0
  34. data/lib/mutant/subject/method/instance.rb +1 -15
  35. data/lib/mutant/test.rb +2 -15
  36. data/lib/mutant/version.rb +1 -1
  37. data/meta/send.rb +16 -0
  38. data/mutant-rspec.gemspec +1 -1
  39. data/mutant.gemspec +1 -1
  40. data/spec/integration/mutant/rspec_spec.rb +0 -6
  41. data/spec/spec_helper.rb +9 -1
  42. data/spec/support/fake_actor.rb +93 -0
  43. data/spec/support/shared_context.rb +135 -0
  44. data/spec/unit/mutant/actor/actor_spec.rb +35 -0
  45. data/spec/unit/mutant/actor/binding_spec.rb +32 -0
  46. data/spec/unit/mutant/actor/env_spec.rb +49 -0
  47. data/spec/unit/mutant/actor/message_spec.rb +23 -0
  48. data/spec/unit/mutant/actor/receiver_spec.rb +60 -0
  49. data/spec/unit/mutant/actor/sender_spec.rb +22 -0
  50. data/spec/unit/mutant/cli_spec.rb +17 -4
  51. data/spec/unit/mutant/env_spec.rb +2 -2
  52. data/spec/unit/mutant/mailbox_spec.rb +33 -0
  53. data/spec/unit/mutant/mutation_spec.rb +52 -18
  54. data/spec/unit/mutant/mutator/registry_spec.rb +4 -4
  55. data/spec/unit/mutant/reporter/cli_spec.rb +131 -249
  56. data/spec/unit/mutant/result/env_spec.rb +55 -0
  57. data/spec/unit/mutant/result/subject_spec.rb +43 -0
  58. data/spec/unit/mutant/runner/master_spec.rb +199 -0
  59. data/spec/unit/mutant/runner/scheduler_spec.rb +161 -0
  60. data/spec/unit/mutant/runner/worker_spec.rb +73 -0
  61. data/spec/unit/mutant/runner_spec.rb +60 -118
  62. data/spec/unit/mutant/subject/method/instance_spec.rb +18 -31
  63. data/spec/unit/mutant/warning_filter_spec.rb +1 -1
  64. metadata +39 -14
  65. data/lib/mutant/runner/collector.rb +0 -133
  66. data/lib/mutant/warning_expectation.rb +0 -47
  67. data/spec/unit/mutant/runner/collector_spec.rb +0 -198
  68. data/spec/unit/mutant/test_spec.rb +0 -23
  69. data/spec/unit/mutant/warning_expectation_spec.rb +0 -80
  70. data/test_app/Gemfile.rspec2 +0 -6
@@ -4,9 +4,58 @@ RSpec.describe Mutant::Mutation do
4
4
  SYMBOL = 'test'.freeze
5
5
  end
6
6
 
7
- let(:object) { TestMutation.new(mutation_subject, Mutant::AST::Nodes::N_NIL) }
8
- let(:mutation_subject) { double('Subject', identification: 'subject', context: context, source: 'original') }
9
- let(:context) { double('Context') }
7
+ let(:object) { TestMutation.new(mutation_subject, Mutant::AST::Nodes::N_NIL) }
8
+ let(:context) { double('Context') }
9
+
10
+ let(:mutation_subject) do
11
+ double(
12
+ 'Subject',
13
+ identification: 'subject',
14
+ context: context,
15
+ source: 'original',
16
+ tests: tests
17
+ )
18
+ end
19
+
20
+ let(:test_a) { double('Test A') }
21
+ let(:test_b) { double('Test B') }
22
+ let(:tests) { [test_a, test_b] }
23
+
24
+ describe '#kill' do
25
+ let(:isolation) { Mutant::Isolation::None }
26
+ let(:integration) { double('Integration') }
27
+ let(:object) { Mutant::Mutation::Evil.new(mutation_subject, Mutant::AST::Nodes::N_NIL) }
28
+ let(:wrapped_node) { double('Wrapped Node') }
29
+
30
+ subject { object.kill(isolation, integration) }
31
+
32
+ before do
33
+ allow(Time).to receive(:now).and_return(Time.at(0))
34
+ end
35
+
36
+ context 'when isolation does not raise error' do
37
+ let(:test_result) { double('Test Result A', passed: false) }
38
+
39
+ before do
40
+ expect(mutation_subject).to receive(:public?).and_return(true).ordered
41
+ expect(mutation_subject).to receive(:prepare).and_return(mutation_subject).ordered
42
+ expect(context).to receive(:root).with(s(:nil)).and_return(wrapped_node).ordered
43
+ expect(Mutant::Loader::Eval).to receive(:call).with(wrapped_node, mutation_subject).and_return(nil).ordered
44
+ expect(integration).to receive(:call).with(tests).and_return(test_result).ordered
45
+ expect(test_result).to receive(:update).with(tests: tests).and_return(test_result).ordered
46
+ end
47
+
48
+ it { should eql(test_result) }
49
+ end
50
+
51
+ context 'when isolation does raise error' do
52
+ before do
53
+ expect(isolation).to receive(:call).and_raise(Mutant::Isolation::Error, 'test-error')
54
+ end
55
+
56
+ it { should eql(Mutant::Result::Test.new(tests: tests, output: 'test-error', passed: false, runtime: 0.0)) }
57
+ end
58
+ end
10
59
 
11
60
  describe '#code' do
12
61
  subject { object.code }
@@ -24,21 +73,6 @@ RSpec.describe Mutant::Mutation do
24
73
  it_should_behave_like 'an idempotent method'
25
74
  end
26
75
 
27
- describe '#insert' do
28
- subject { object.insert }
29
-
30
- let(:wrapped_node) { double('Wrapped Node') }
31
-
32
- before do
33
- expect(mutation_subject).to receive(:public?).ordered.and_return(true)
34
- expect(mutation_subject).to receive(:prepare).ordered
35
- expect(context).to receive(:root).ordered.with(s(:nil)).and_return(wrapped_node)
36
- expect(Mutant::Loader::Eval).to receive(:call).ordered.with(wrapped_node, mutation_subject).and_return(nil)
37
- end
38
-
39
- it_should_behave_like 'a command method'
40
- end
41
-
42
76
  describe '#source' do
43
77
  subject { object.source }
44
78
 
@@ -2,7 +2,7 @@ RSpec.describe Mutant::Mutator::Registry do
2
2
  describe '#lookup' do
3
3
  subject { Mutant::Mutator::REGISTRY.lookup(node) }
4
4
 
5
- context 'on registred node' do
5
+ context 'on registered node' do
6
6
  let(:node) { s(:true) }
7
7
 
8
8
  it { should eql(Mutant::Mutator::Node::Literal::Boolean) }
@@ -12,7 +12,7 @@ RSpec.describe Mutant::Mutator::Registry do
12
12
  let(:node) { s(:unknown) }
13
13
 
14
14
  it 'raises error' do
15
- expect { subject }.to raise_error(described_class::RegistryError, "No mutator to handle: :unknown")
15
+ expect { subject }.to raise_error(described_class::RegistryError, 'No mutator to handle: :unknown')
16
16
  end
17
17
  end
18
18
  end
@@ -24,7 +24,7 @@ RSpec.describe Mutant::Mutator::Registry do
24
24
 
25
25
  subject { object.register(type, mutator) }
26
26
 
27
- context 'when registring an invalid node type' do
27
+ context 'when registering an invalid node type' do
28
28
  let(:type) { :invalid }
29
29
 
30
30
  it 'raises error' do
@@ -32,7 +32,7 @@ RSpec.describe Mutant::Mutator::Registry do
32
32
  end
33
33
  end
34
34
 
35
- context 'when registring a valid node type' do
35
+ context 'when registering a valid node type' do
36
36
  let(:type) { :true }
37
37
 
38
38
  it 'allows to lookup mutator' do
@@ -1,4 +1,6 @@
1
1
  RSpec.describe Mutant::Reporter::CLI do
2
+ setup_shared_context
3
+
2
4
  let(:object) { described_class.new(output, format) }
3
5
  let(:output) { StringIO.new }
4
6
 
@@ -31,110 +33,6 @@ RSpec.describe Mutant::Reporter::CLI do
31
33
  allow(Time).to receive(:now).and_return(Time.now)
32
34
  end
33
35
 
34
- let(:result) do
35
- Mutant::Result::Env.new(
36
- env: env,
37
- runtime: 1.1,
38
- subject_results: subject_results
39
- )
40
- end
41
-
42
- let(:env) do
43
- double(
44
- 'Env',
45
- class: Mutant::Env,
46
- matchable_scopes: matchable_scopes,
47
- config: config,
48
- subjects: subjects,
49
- mutations: subjects.flat_map(&:mutations)
50
- )
51
- end
52
-
53
- let(:config) { Mutant::Config::DEFAULT.update(jobs: 1) }
54
- let(:mutation_class) { Mutant::Mutation::Evil }
55
- let(:matchable_scopes) { double('Matchable Scopes', length: 10) }
56
-
57
- before do
58
- allow(mutation_a).to receive(:subject).and_return(_subject)
59
- allow(mutation_b).to receive(:subject).and_return(_subject)
60
- end
61
-
62
- let(:mutation_a) do
63
- double(
64
- 'Mutation',
65
- identification: 'mutation_id-a',
66
- class: mutation_class,
67
- original_source: 'true',
68
- source: mutation_source
69
- )
70
- end
71
-
72
- let(:mutation_b) do
73
- double(
74
- 'Mutation',
75
- identification: 'mutation_id-b',
76
- class: mutation_class,
77
- original_source: 'true',
78
- source: mutation_source
79
- )
80
- end
81
-
82
- let(:mutation_source) { 'false' }
83
-
84
- let(:_subject) do
85
- double(
86
- 'Subject',
87
- class: Mutant::Subject,
88
- node: s(:true),
89
- identification: 'subject_id',
90
- mutations: subject_mutations,
91
- tests: [
92
- double('Test', identification: 'test_id')
93
- ]
94
- )
95
- end
96
-
97
- let(:subject_mutations) { [mutation_a] }
98
-
99
- let(:test_results) do
100
- [
101
- double(
102
- 'Test Result',
103
- class: Mutant::Result::Test,
104
- test: _subject.tests.first,
105
- runtime: 1.0,
106
- output: 'test-output',
107
- success?: mutation_result_success
108
- )
109
- ]
110
- end
111
-
112
- let(:mutation_a_result) do
113
- double(
114
- 'Mutation Result',
115
- class: Mutant::Result::Mutation,
116
- mutation: mutation_a,
117
- killtime: 0.5,
118
- runtime: 1.0,
119
- index: 0,
120
- success?: mutation_result_success,
121
- test_results: test_results,
122
- failed_test_results: mutation_result_success ? [] : test_results
123
- )
124
- end
125
-
126
- let(:subject_results) do
127
- [
128
- Mutant::Result::Subject.new(
129
- subject: _subject,
130
- runtime: 1.0,
131
- mutation_results: [mutation_a_result]
132
- )
133
- ]
134
- end
135
-
136
- let(:subjects) { [_subject] }
137
-
138
36
  describe '.build' do
139
37
  subject { described_class.build(output) }
140
38
 
@@ -210,47 +108,35 @@ RSpec.describe Mutant::Reporter::CLI do
210
108
  end
211
109
 
212
110
  describe '#progress' do
213
- subject { object.progress(collector) }
214
-
215
- let(:collector) do
216
- Mutant::Runner::Collector.new(env)
217
- end
218
-
219
- let(:mutation_result_success) { true }
111
+ subject { object.progress(status) }
220
112
 
221
113
  context 'on progressive format' do
222
-
223
114
  let(:format) { progressive_format }
224
115
 
225
- context 'with empty collector' do
116
+ context 'with empty scheduler' do
117
+ update(:env_result) { { subject_results: [] } }
226
118
 
227
119
  it_reports ''
228
120
  end
229
121
 
230
122
  context 'with last mutation present' do
231
-
232
- before do
233
- collector.start(mutation_a)
234
- collector.finish(mutation_a_result)
235
- end
123
+ update(:env_result) { { subject_results: [subject_a_result] } }
236
124
 
237
125
  context 'when mutation is successful' do
238
- it_reports '.'
126
+ it_reports '..'
239
127
  end
240
128
 
241
129
  context 'when mutation is NOT successful' do
242
- let(:mutation_result_success) { false }
243
-
244
- it_reports 'F'
130
+ update(:mutation_a_test_result) { { passed: true } }
131
+ it_reports 'F.'
245
132
  end
246
133
  end
247
134
  end
248
135
 
249
136
  context 'on framed format' do
137
+ context 'with empty scheduler' do
138
+ update(:env_result) { { subject_results: [] } }
250
139
 
251
- let(:mutation_result_success) { true }
252
-
253
- context 'with empty collector' do
254
140
  it_reports <<-REPORT
255
141
  Mutant configuration:
256
142
  Matcher: #<Mutant::Matcher::Config match_expressions=[] subject_ignores=[] subject_selects=[]>
@@ -261,24 +147,21 @@ RSpec.describe Mutant::Reporter::CLI do
261
147
  Requires: []
262
148
  Available Subjects: 1
263
149
  Subjects: 1
264
- Mutations: 1
150
+ Mutations: 2
265
151
  Kills: 0
266
152
  Alive: 0
267
- Runtime: 0.00s
153
+ Runtime: 4.00s
268
154
  Killtime: 0.00s
269
- Overhead: NaN%
155
+ Overhead: Inf%
270
156
  Coverage: 0.00%
271
157
  Expected: 100.00%
272
158
  Active subjects: 0
273
159
  REPORT
274
160
  end
275
161
 
276
- context 'with collector active on one subject' do
277
- before do
278
- collector.start(mutation_a)
279
- end
280
-
162
+ context 'with scheduler active on one subject' do
281
163
  context 'without progress' do
164
+ update(:status) { { active_jobs: [].to_set } }
282
165
 
283
166
  it_reports(<<-REPORT)
284
167
  Mutant configuration:
@@ -290,32 +173,23 @@ RSpec.describe Mutant::Reporter::CLI do
290
173
  Requires: []
291
174
  Available Subjects: 1
292
175
  Subjects: 1
293
- Mutations: 1
294
- Kills: 0
176
+ Mutations: 2
177
+ Kills: 2
295
178
  Alive: 0
296
- Runtime: 0.00s
297
- Killtime: 0.00s
298
- Overhead: NaN%
299
- Coverage: 0.00%
179
+ Runtime: 4.00s
180
+ Killtime: 2.00s
181
+ Overhead: 100.00%
182
+ Coverage: 100.00%
300
183
  Expected: 100.00%
301
- Active subjects: 1
302
- subject_id mutations: 1
303
- - test_id
304
- (00/01) 0% - killtime: 0.00s runtime: 0.00s overhead: 0.00s
184
+ Active subjects: 0
305
185
  REPORT
306
186
  end
307
187
 
308
188
  context 'with progress' do
309
-
310
- let(:subject_mutations) { [mutation_a, mutation_b] }
311
-
312
- before do
313
- collector.start(mutation_b)
314
- collector.finish(mutation_a_result)
315
- end
189
+ update(:status) { { active_jobs: [job_a].to_set } }
316
190
 
317
191
  context 'on failure' do
318
- let(:mutation_result_success) { false }
192
+ update(:mutation_a_test_result) { { passed: true } }
319
193
 
320
194
  it_reports(<<-REPORT)
321
195
  Mutant configuration:
@@ -328,18 +202,20 @@ RSpec.describe Mutant::Reporter::CLI do
328
202
  Available Subjects: 1
329
203
  Subjects: 1
330
204
  Mutations: 2
331
- Kills: 0
205
+ Kills: 1
332
206
  Alive: 1
333
- Runtime: 0.00s
334
- Killtime: 0.50s
335
- Overhead: -100.00%
336
- Coverage: 0.00%
207
+ Runtime: 4.00s
208
+ Killtime: 2.00s
209
+ Overhead: 100.00%
210
+ Coverage: 50.00%
337
211
  Expected: 100.00%
338
212
  Active subjects: 1
339
- subject_id mutations: 2
340
- - test_id
341
- F
342
- (00/02) 0% - killtime: 0.50s runtime: 1.00s overhead: 0.50s
213
+ subject-a mutations: 2
214
+ - test-a
215
+ F.
216
+ (01/02) 50% - killtime: 2.00s runtime: 2.00s overhead: 0.00s
217
+ Active Jobs:
218
+ 0: evil:subject-a:d27d2
343
219
  REPORT
344
220
  end
345
221
 
@@ -355,18 +231,20 @@ RSpec.describe Mutant::Reporter::CLI do
355
231
  Available Subjects: 1
356
232
  Subjects: 1
357
233
  Mutations: 2
358
- Kills: 1
234
+ Kills: 2
359
235
  Alive: 0
360
- Runtime: 0.00s
361
- Killtime: 0.50s
362
- Overhead: -100.00%
236
+ Runtime: 4.00s
237
+ Killtime: 2.00s
238
+ Overhead: 100.00%
363
239
  Coverage: 100.00%
364
240
  Expected: 100.00%
365
241
  Active subjects: 1
366
- subject_id mutations: 2
367
- - test_id
368
- .
369
- (01/02) 100% - killtime: 0.50s runtime: 1.00s overhead: 0.50s
242
+ subject-a mutations: 2
243
+ - test-a
244
+ ..
245
+ (02/02) 100% - killtime: 2.00s runtime: 2.00s overhead: 0.00s
246
+ Active Jobs:
247
+ 0: evil:subject-a:d27d2
370
248
  REPORT
371
249
  end
372
250
  end
@@ -374,11 +252,9 @@ RSpec.describe Mutant::Reporter::CLI do
374
252
  end
375
253
 
376
254
  describe '#report' do
377
- subject { object.report(result) }
255
+ subject { object.report(status.env_result) }
378
256
 
379
257
  context 'with full coverage' do
380
- let(:mutation_result_success) { true }
381
-
382
258
  it_reports(<<-REPORT)
383
259
  Mutant configuration:
384
260
  Matcher: #<Mutant::Matcher::Config match_expressions=[] subject_ignores=[] subject_selects=[]>
@@ -389,26 +265,26 @@ RSpec.describe Mutant::Reporter::CLI do
389
265
  Requires: []
390
266
  Available Subjects: 1
391
267
  Subjects: 1
392
- Mutations: 1
393
- Kills: 1
268
+ Mutations: 2
269
+ Kills: 2
394
270
  Alive: 0
395
- Runtime: 1.10s
396
- Killtime: 0.50s
397
- Overhead: 120.00%
271
+ Runtime: 4.00s
272
+ Killtime: 2.00s
273
+ Overhead: 100.00%
398
274
  Coverage: 100.00%
399
275
  Expected: 100.00%
400
276
  REPORT
401
277
  end
402
278
 
403
279
  context 'and partial coverage' do
404
- let(:mutation_result_success) { false }
280
+ update(:mutation_a_test_result) { { passed: true } }
405
281
 
406
282
  context 'on evil mutation' do
407
283
  context 'with a diff' do
408
284
  it_reports(<<-REPORT)
409
- subject_id
410
- - test_id
411
- mutation_id-a
285
+ subject-a
286
+ - test-a
287
+ evil:subject-a:d27d2
412
288
  @@ -1,2 +1,2 @@
413
289
  -true
414
290
  +false
@@ -422,29 +298,29 @@ RSpec.describe Mutant::Reporter::CLI do
422
298
  Requires: []
423
299
  Available Subjects: 1
424
300
  Subjects: 1
425
- Mutations: 1
426
- Kills: 0
301
+ Mutations: 2
302
+ Kills: 1
427
303
  Alive: 1
428
- Runtime: 1.10s
429
- Killtime: 0.50s
430
- Overhead: 120.00%
431
- Coverage: 0.00%
304
+ Runtime: 4.00s
305
+ Killtime: 2.00s
306
+ Overhead: 100.00%
307
+ Coverage: 50.00%
432
308
  Expected: 100.00%
433
309
  REPORT
434
310
  end
435
311
 
436
312
  context 'without a diff' do
437
- let(:mutation_source) { 'true' }
313
+ let(:mutation_a_node) { s(:true) }
438
314
 
439
315
  it_reports(<<-REPORT)
440
- subject_id
441
- - test_id
442
- mutation_id-a
316
+ subject-a
317
+ - test-a
318
+ evil:subject-a:d5318
443
319
  Original source:
444
320
  true
445
321
  Mutated Source:
446
322
  true
447
- BUG: Mutation NOT resulted in exactly one diff. Please report a reproduction!
323
+ BUG: Mutation NOT resulted in exactly one diff hunk. Please report a reproduction!
448
324
  -----------------------
449
325
  Mutant configuration:
450
326
  Matcher: #<Mutant::Matcher::Config match_expressions=[] subject_ignores=[] subject_selects=[]>
@@ -455,26 +331,29 @@ RSpec.describe Mutant::Reporter::CLI do
455
331
  Requires: []
456
332
  Available Subjects: 1
457
333
  Subjects: 1
458
- Mutations: 1
459
- Kills: 0
334
+ Mutations: 2
335
+ Kills: 1
460
336
  Alive: 1
461
- Runtime: 1.10s
462
- Killtime: 0.50s
463
- Overhead: 120.00%
464
- Coverage: 0.00%
337
+ Runtime: 4.00s
338
+ Killtime: 2.00s
339
+ Overhead: 100.00%
340
+ Coverage: 50.00%
465
341
  Expected: 100.00%
466
342
  REPORT
467
343
  end
468
344
  end
469
345
 
470
346
  context 'on neutral mutation' do
471
- let(:mutation_class) { Mutant::Mutation::Neutral }
472
- let(:mutation_source) { 'true' }
347
+ update(:mutation_a_test_result) { { passed: false } }
348
+
349
+ let(:mutation_a) do
350
+ Mutant::Mutation::Neutral.new(subject_a, s(:true))
351
+ end
473
352
 
474
353
  it_reports(<<-REPORT)
475
- subject_id
476
- - test_id
477
- mutation_id-a
354
+ subject-a
355
+ - test-a
356
+ neutral:subject-a:d5318
478
357
  --- Neutral failure ---
479
358
  Original code was inserted unmutated. And the test did NOT PASS.
480
359
  Your tests do not pass initially or you found a bug in mutant / unparser.
@@ -482,10 +361,25 @@ RSpec.describe Mutant::Reporter::CLI do
482
361
  (true)
483
362
  Unparsed Source:
484
363
  true
485
- Test Reports: 1
486
- - test_id / runtime: 1.0
364
+ Test Result:
365
+ - 1 @ runtime: 1.0
366
+ - test-a
487
367
  Test Output:
488
- test-output
368
+ mutation a test result output
369
+ -----------------------
370
+ neutral:subject-a:d5318
371
+ --- Neutral failure ---
372
+ Original code was inserted unmutated. And the test did NOT PASS.
373
+ Your tests do not pass initially or you found a bug in mutant / unparser.
374
+ Subject AST:
375
+ (true)
376
+ Unparsed Source:
377
+ true
378
+ Test Result:
379
+ - 1 @ runtime: 1.0
380
+ - test-a
381
+ Test Output:
382
+ mutation b test result output
489
383
  -----------------------
490
384
  Mutant configuration:
491
385
  Matcher: #<Mutant::Matcher::Config match_expressions=[] subject_ignores=[] subject_selects=[]>
@@ -496,31 +390,46 @@ RSpec.describe Mutant::Reporter::CLI do
496
390
  Requires: []
497
391
  Available Subjects: 1
498
392
  Subjects: 1
499
- Mutations: 1
393
+ Mutations: 2
500
394
  Kills: 0
501
- Alive: 1
502
- Runtime: 1.10s
503
- Killtime: 0.50s
504
- Overhead: 120.00%
395
+ Alive: 2
396
+ Runtime: 4.00s
397
+ Killtime: 2.00s
398
+ Overhead: 100.00%
505
399
  Coverage: 0.00%
506
400
  Expected: 100.00%
507
401
  REPORT
508
402
  end
509
403
 
510
404
  context 'on noop mutation' do
511
- let(:mutation_class) { Mutant::Mutation::Noop }
405
+ update(:mutation_a_test_result) { { passed: false } }
406
+
407
+ let(:mutation_a) do
408
+ Mutant::Mutation::Noop.new(subject_a, s(:true))
409
+ end
512
410
 
513
411
  it_reports(<<-REPORT)
514
- subject_id
515
- - test_id
516
- mutation_id-a
412
+ subject-a
413
+ - test-a
414
+ noop:subject-a:d5318
517
415
  ---- Noop failure -----
518
416
  No code was inserted. And the test did NOT PASS.
519
417
  This is typically a problem of your specs not passing unmutated.
520
- Test Reports: 1
521
- - test_id / runtime: 1.0
418
+ Test Result:
419
+ - 1 @ runtime: 1.0
420
+ - test-a
522
421
  Test Output:
523
- test-output
422
+ mutation a test result output
423
+ -----------------------
424
+ noop:subject-a:d5318
425
+ ---- Noop failure -----
426
+ No code was inserted. And the test did NOT PASS.
427
+ This is typically a problem of your specs not passing unmutated.
428
+ Test Result:
429
+ - 1 @ runtime: 1.0
430
+ - test-a
431
+ Test Output:
432
+ mutation b test result output
524
433
  -----------------------
525
434
  Mutant configuration:
526
435
  Matcher: #<Mutant::Matcher::Config match_expressions=[] subject_ignores=[] subject_selects=[]>
@@ -531,44 +440,17 @@ RSpec.describe Mutant::Reporter::CLI do
531
440
  Requires: []
532
441
  Available Subjects: 1
533
442
  Subjects: 1
534
- Mutations: 1
443
+ Mutations: 2
535
444
  Kills: 0
536
- Alive: 1
537
- Runtime: 1.10s
538
- Killtime: 0.50s
539
- Overhead: 120.00%
445
+ Alive: 2
446
+ Runtime: 4.00s
447
+ Killtime: 2.00s
448
+ Overhead: 100.00%
540
449
  Coverage: 0.00%
541
450
  Expected: 100.00%
542
451
  REPORT
543
452
  end
544
453
  end
545
-
546
- context 'without subjects' do
547
- let(:subjects) { [] }
548
- let(:subject_results) { [] }
549
-
550
- let(:config) { Mutant::Config::DEFAULT.update(jobs: 1, includes: %w[include-dir], requires: %w[require-name]) }
551
-
552
- it_reports(<<-REPORT)
553
- Mutant configuration:
554
- Matcher: #<Mutant::Matcher::Config match_expressions=[] subject_ignores=[] subject_selects=[]>
555
- Integration: null
556
- Expect Coverage: 100.00%
557
- Jobs: 1
558
- Includes: ["include-dir"]
559
- Requires: ["require-name"]
560
- Available Subjects: 0
561
- Subjects: 0
562
- Mutations: 0
563
- Kills: 0
564
- Alive: 0
565
- Runtime: 1.10s
566
- Killtime: 0.00s
567
- Overhead: Inf%
568
- Coverage: 0.00%
569
- Expected: 100.00%
570
- REPORT
571
- end
572
454
  end
573
455
  end
574
456
  end