mutant 0.8.24 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/Changelog.md +14 -654
- data/Gemfile +13 -0
- data/Gemfile.lock +59 -64
- data/LICENSE +271 -20
- data/README.md +73 -140
- data/Rakefile +0 -21
- data/bin/mutant +7 -2
- data/config/reek.yml +2 -1
- data/config/rubocop.yml +5 -9
- data/docs/incremental.md +76 -0
- data/docs/known-problems.md +0 -14
- data/docs/mutant-minitest.md +1 -1
- data/docs/mutant-rspec.md +2 -24
- data/lib/mutant.rb +45 -53
- data/lib/mutant/ast/nodes.rb +0 -2
- data/lib/mutant/ast/types.rb +1 -117
- data/lib/mutant/base.rb +192 -0
- data/lib/mutant/bootstrap.rb +145 -0
- data/lib/mutant/cli.rb +68 -54
- data/lib/mutant/config.rb +119 -6
- data/lib/mutant/env.rb +94 -8
- data/lib/mutant/expression.rb +6 -1
- data/lib/mutant/expression/parser.rb +9 -31
- data/lib/mutant/integration.rb +64 -36
- data/lib/mutant/isolation.rb +16 -1
- data/lib/mutant/isolation/fork.rb +105 -40
- data/lib/mutant/license.rb +34 -0
- data/lib/mutant/license/subscription.rb +47 -0
- data/lib/mutant/license/subscription/commercial.rb +57 -0
- data/lib/mutant/license/subscription/opensource.rb +77 -0
- data/lib/mutant/loader.rb +27 -4
- data/lib/mutant/matcher.rb +48 -1
- data/lib/mutant/matcher/chain.rb +1 -1
- data/lib/mutant/matcher/config.rb +0 -2
- data/lib/mutant/matcher/filter.rb +1 -1
- data/lib/mutant/matcher/method.rb +11 -7
- data/lib/mutant/matcher/methods.rb +1 -1
- data/lib/mutant/matcher/namespace.rb +1 -1
- data/lib/mutant/matcher/null.rb +1 -1
- data/lib/mutant/matcher/scope.rb +1 -1
- data/lib/mutant/meta/example/dsl.rb +0 -8
- data/lib/mutant/mutation.rb +1 -2
- data/lib/mutant/mutator/node.rb +2 -9
- data/lib/mutant/mutator/node/arguments.rb +1 -1
- data/lib/mutant/mutator/node/class.rb +0 -8
- data/lib/mutant/mutator/node/define.rb +0 -12
- data/lib/mutant/mutator/node/generic.rb +30 -44
- data/lib/mutant/mutator/node/index.rb +4 -4
- data/lib/mutant/mutator/node/literal/regex.rb +0 -39
- data/lib/mutant/mutator/node/send.rb +13 -12
- data/lib/mutant/parallel.rb +61 -40
- data/lib/mutant/parallel/driver.rb +59 -0
- data/lib/mutant/parallel/source.rb +6 -2
- data/lib/mutant/parallel/worker.rb +63 -45
- data/lib/mutant/range.rb +15 -0
- data/lib/mutant/reporter/cli.rb +5 -11
- data/lib/mutant/reporter/cli/format.rb +3 -46
- data/lib/mutant/reporter/cli/printer/config.rb +5 -6
- data/lib/mutant/reporter/cli/printer/env.rb +40 -0
- data/lib/mutant/reporter/cli/printer/env_progress.rb +13 -17
- data/lib/mutant/reporter/cli/printer/isolation_result.rb +17 -3
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +2 -3
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +19 -10
- data/lib/mutant/repository.rb +0 -65
- data/lib/mutant/repository/diff.rb +104 -0
- data/lib/mutant/repository/diff/ranges.rb +52 -0
- data/lib/mutant/result.rb +16 -7
- data/lib/mutant/runner.rb +38 -47
- data/lib/mutant/runner/sink.rb +1 -1
- data/lib/mutant/selector/null.rb +19 -0
- data/lib/mutant/subject.rb +3 -1
- data/lib/mutant/subject/method/instance.rb +3 -1
- data/lib/mutant/transform.rb +511 -0
- data/lib/mutant/variable.rb +282 -0
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warnings.rb +113 -0
- data/meta/case.rb +1 -0
- data/meta/class.rb +0 -9
- data/meta/def.rb +1 -26
- data/meta/regexp.rb +10 -20
- data/meta/send.rb +14 -46
- data/mutant-minitest.gemspec +1 -1
- data/mutant-rspec.gemspec +2 -2
- data/mutant.gemspec +15 -16
- data/mutant.yml +6 -0
- data/spec/integration/mutant/isolation/fork_spec.rb +22 -5
- data/spec/integration/mutant/minitest_spec.rb +3 -2
- data/spec/integration/mutant/rspec_spec.rb +4 -3
- data/spec/integrations.yml +16 -13
- data/spec/shared/base_behavior.rb +45 -0
- data/spec/shared/framework_integration_behavior.rb +43 -14
- data/spec/spec_helper.rb +21 -17
- data/spec/support/corpus.rb +56 -95
- data/spec/support/shared_context.rb +37 -14
- data/spec/support/xspec.rb +7 -3
- data/spec/unit/mutant/bootstrap_spec.rb +216 -0
- data/spec/unit/mutant/cli_spec.rb +173 -117
- data/spec/unit/mutant/config_spec.rb +126 -0
- data/spec/unit/mutant/either_spec.rb +247 -0
- data/spec/unit/mutant/env_spec.rb +162 -40
- data/spec/unit/mutant/expression/method_spec.rb +16 -0
- data/spec/unit/mutant/expression/parser_spec.rb +29 -33
- data/spec/unit/mutant/expression_spec.rb +5 -7
- data/spec/unit/mutant/integration_spec.rb +100 -9
- data/spec/unit/mutant/isolation/fork_spec.rb +125 -67
- data/spec/unit/mutant/isolation/result_spec.rb +33 -1
- data/spec/unit/mutant/license_spec.rb +257 -0
- data/spec/unit/mutant/loader_spec.rb +50 -11
- data/spec/unit/mutant/matcher/compiler_spec.rb +0 -78
- data/spec/unit/mutant/matcher/method/instance_spec.rb +55 -11
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +12 -2
- data/spec/unit/mutant/matcher_spec.rb +102 -0
- data/spec/unit/mutant/maybe_spec.rb +60 -0
- data/spec/unit/mutant/meta/example/dsl_spec.rb +1 -17
- data/spec/unit/mutant/mutation_spec.rb +13 -6
- data/spec/unit/mutant/parallel/driver_spec.rb +112 -14
- data/spec/unit/mutant/parallel/source/array_spec.rb +25 -17
- data/spec/unit/mutant/parallel/worker_spec.rb +182 -44
- data/spec/unit/mutant/parallel_spec.rb +105 -8
- data/spec/unit/mutant/range_spec.rb +141 -0
- data/spec/unit/mutant/reporter/cli/printer/config_spec.rb +7 -21
- data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +15 -6
- data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +10 -2
- data/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb +12 -4
- data/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +31 -2
- data/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +4 -4
- data/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb +5 -0
- data/spec/unit/mutant/reporter/cli_spec.rb +46 -123
- data/spec/unit/mutant/repository/diff/ranges_spec.rb +180 -0
- data/spec/unit/mutant/repository/diff_spec.rb +84 -71
- data/spec/unit/mutant/require_highjack_spec.rb +1 -1
- data/spec/unit/mutant/result/env_spec.rb +39 -9
- data/spec/unit/mutant/result/test_spec.rb +14 -0
- data/spec/unit/mutant/runner_spec.rb +88 -41
- data/spec/unit/mutant/selector/expression_spec.rb +11 -10
- data/spec/unit/mutant/selector/null_spec.rb +17 -0
- data/spec/unit/mutant/subject/method/instance_spec.rb +44 -5
- data/spec/unit/mutant/subject/method/singleton_spec.rb +9 -2
- data/spec/unit/mutant/subject_spec.rb +9 -1
- data/spec/unit/mutant/transform/array_spec.rb +92 -0
- data/spec/unit/mutant/transform/bool_spec.rb +63 -0
- data/spec/unit/mutant/transform/error_spec.rb +132 -0
- data/spec/unit/mutant/transform/exception_spec.rb +44 -0
- data/spec/unit/mutant/transform/hash_spec.rb +236 -0
- data/spec/unit/mutant/transform/index_spec.rb +92 -0
- data/spec/unit/mutant/transform/named_spec.rb +49 -0
- data/spec/unit/mutant/transform/primitive_spec.rb +56 -0
- data/spec/unit/mutant/transform/sequence_spec.rb +98 -0
- data/spec/unit/mutant/variable_spec.rb +618 -0
- data/spec/unit/mutant/warnings_spec.rb +89 -0
- data/spec/unit/mutant/world_spec.rb +63 -0
- data/test_app/Gemfile.minitest +0 -2
- metadata +79 -113
- data/.gitattributes +0 -1
- data/.ruby-gemset +0 -1
- data/config/triage.yml +0 -2
- data/lib/mutant/actor.rb +0 -57
- data/lib/mutant/actor/env.rb +0 -31
- data/lib/mutant/actor/mailbox.rb +0 -34
- data/lib/mutant/actor/receiver.rb +0 -42
- data/lib/mutant/actor/sender.rb +0 -26
- data/lib/mutant/ast/meta/restarg.rb +0 -19
- data/lib/mutant/ast/regexp.rb +0 -42
- data/lib/mutant/ast/regexp/transformer.rb +0 -187
- data/lib/mutant/ast/regexp/transformer/direct.rb +0 -123
- data/lib/mutant/ast/regexp/transformer/named_group.rb +0 -59
- data/lib/mutant/ast/regexp/transformer/options_group.rb +0 -83
- data/lib/mutant/ast/regexp/transformer/quantifier.rb +0 -114
- data/lib/mutant/ast/regexp/transformer/recursive.rb +0 -58
- data/lib/mutant/ast/regexp/transformer/root.rb +0 -31
- data/lib/mutant/ast/regexp/transformer/text.rb +0 -60
- data/lib/mutant/env/bootstrap.rb +0 -160
- data/lib/mutant/matcher/compiler.rb +0 -60
- data/lib/mutant/mutator/node/regexp.rb +0 -35
- data/lib/mutant/mutator/node/regexp/alternation_meta.rb +0 -23
- data/lib/mutant/mutator/node/regexp/capture_group.rb +0 -28
- data/lib/mutant/mutator/node/regexp/character_type.rb +0 -32
- data/lib/mutant/mutator/node/regexp/end_of_line_anchor.rb +0 -23
- data/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb +0 -23
- data/lib/mutant/mutator/node/regexp/greedy_zero_or_more.rb +0 -27
- data/lib/mutant/parallel/master.rb +0 -181
- data/lib/mutant/reporter/cli/printer/status.rb +0 -53
- data/lib/mutant/reporter/cli/tput.rb +0 -46
- data/lib/mutant/warning_filter.rb +0 -61
- data/meta/regexp/character_types.rb +0 -23
- data/meta/regexp/regexp_alternation_meta.rb +0 -13
- data/meta/regexp/regexp_bol_anchor.rb +0 -10
- data/meta/regexp/regexp_bos_anchor.rb +0 -18
- data/meta/regexp/regexp_capture_group.rb +0 -19
- data/meta/regexp/regexp_eol_anchor.rb +0 -10
- data/meta/regexp/regexp_eos_anchor.rb +0 -8
- data/meta/regexp/regexp_eos_ob_eol_anchor.rb +0 -10
- data/meta/regexp/regexp_greedy_zero_or_more.rb +0 -12
- data/meta/regexp/regexp_root_expression.rb +0 -10
- data/meta/restarg.rb +0 -10
- data/spec/support/fake_actor.rb +0 -111
- data/spec/support/warning.rb +0 -66
- data/spec/unit/mutant/actor/binding_spec.rb +0 -34
- data/spec/unit/mutant/actor/env_spec.rb +0 -31
- data/spec/unit/mutant/actor/mailbox_spec.rb +0 -28
- data/spec/unit/mutant/actor/message_spec.rb +0 -25
- data/spec/unit/mutant/actor/receiver_spec.rb +0 -58
- data/spec/unit/mutant/actor/sender_spec.rb +0 -24
- data/spec/unit/mutant/ast/regexp/parse_spec.rb +0 -19
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table/table_spec.rb +0 -21
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table_spec.rb +0 -35
- data/spec/unit/mutant/ast/regexp/transformer_spec.rb +0 -21
- data/spec/unit/mutant/ast/regexp_spec.rb +0 -704
- data/spec/unit/mutant/env/bootstrap_spec.rb +0 -188
- data/spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb +0 -26
- data/spec/unit/mutant/parallel/master_spec.rb +0 -338
- data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +0 -121
- data/spec/unit/mutant/reporter/cli/tput_spec.rb +0 -50
- data/spec/unit/mutant/warning_filter_spec.rb +0 -106
- data/spec/unit/mutant_spec.rb +0 -17
- data/test_app/Gemfile.rspec3.7 +0 -7
@@ -6,26 +6,12 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Config do
|
|
6
6
|
let(:reportable) { config }
|
7
7
|
|
8
8
|
describe '.call' do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
Requires: []
|
17
|
-
REPORT
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'with non default coverage expectation' do
|
21
|
-
it_reports(<<~REPORT)
|
22
|
-
Mutant configuration:
|
23
|
-
Matcher: #<Mutant::Matcher::Config empty>
|
24
|
-
Integration: Mutant::Integration::Null
|
25
|
-
Jobs: 1
|
26
|
-
Includes: []
|
27
|
-
Requires: []
|
28
|
-
REPORT
|
29
|
-
end
|
9
|
+
it_reports(<<~'REPORT')
|
10
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
11
|
+
Integration: null
|
12
|
+
Jobs: 1
|
13
|
+
Includes: []
|
14
|
+
Requires: []
|
15
|
+
REPORT
|
30
16
|
end
|
31
17
|
end
|
@@ -10,13 +10,16 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
|
|
10
10
|
with(:subject_a_result) { { mutation_results: [] } }
|
11
11
|
|
12
12
|
it_reports <<~'STR'
|
13
|
-
Mutant
|
13
|
+
Mutant environment:
|
14
14
|
Matcher: #<Mutant::Matcher::Config empty>
|
15
|
-
Integration:
|
15
|
+
Integration: null
|
16
16
|
Jobs: 1
|
17
17
|
Includes: []
|
18
18
|
Requires: []
|
19
19
|
Subjects: 1
|
20
|
+
Total-Tests: 1
|
21
|
+
Selected-Tests: 1
|
22
|
+
Tests/Subject: 1.00 avg
|
20
23
|
Mutations: 2
|
21
24
|
Results: 0
|
22
25
|
Kills: 0
|
@@ -31,13 +34,16 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
|
|
31
34
|
|
32
35
|
context 'on full coverage' do
|
33
36
|
it_reports <<~'STR'
|
34
|
-
Mutant
|
37
|
+
Mutant environment:
|
35
38
|
Matcher: #<Mutant::Matcher::Config empty>
|
36
|
-
Integration:
|
39
|
+
Integration: null
|
37
40
|
Jobs: 1
|
38
41
|
Includes: []
|
39
42
|
Requires: []
|
40
43
|
Subjects: 1
|
44
|
+
Total-Tests: 1
|
45
|
+
Selected-Tests: 1
|
46
|
+
Tests/Subject: 1.00 avg
|
41
47
|
Mutations: 2
|
42
48
|
Results: 2
|
43
49
|
Kills: 2
|
@@ -54,13 +60,16 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
|
|
54
60
|
with(:mutation_a_test_result) { { passed: true } }
|
55
61
|
|
56
62
|
it_reports <<~'STR'
|
57
|
-
Mutant
|
63
|
+
Mutant environment:
|
58
64
|
Matcher: #<Mutant::Matcher::Config empty>
|
59
|
-
Integration:
|
65
|
+
Integration: null
|
60
66
|
Jobs: 1
|
61
67
|
Includes: []
|
62
68
|
Requires: []
|
63
69
|
Subjects: 1
|
70
|
+
Total-Tests: 1
|
71
|
+
Selected-Tests: 1
|
72
|
+
Tests/Subject: 1.00 avg
|
64
73
|
Mutations: 2
|
65
74
|
Results: 2
|
66
75
|
Kills: 1
|
@@ -16,13 +16,21 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvResult do
|
|
16
16
|
-true
|
17
17
|
+false
|
18
18
|
-----------------------
|
19
|
-
|
19
|
+
- 1 @ runtime: 1.0
|
20
|
+
- test-a
|
21
|
+
Test Output:
|
22
|
+
mutation a test result output
|
23
|
+
-----------------------
|
24
|
+
Mutant environment:
|
20
25
|
Matcher: #<Mutant::Matcher::Config empty>
|
21
|
-
Integration:
|
26
|
+
Integration: null
|
22
27
|
Jobs: 1
|
23
28
|
Includes: []
|
24
29
|
Requires: []
|
25
30
|
Subjects: 1
|
31
|
+
Total-Tests: 1
|
32
|
+
Selected-Tests: 1
|
33
|
+
Tests/Subject: 1.00 avg
|
26
34
|
Mutations: 2
|
27
35
|
Results: 2
|
28
36
|
Kills: 1
|
@@ -77,13 +77,17 @@ RSpec.describe Mutant::Reporter::CLI::Printer::IsolationResult do
|
|
77
77
|
instance_double(
|
78
78
|
Process::Status,
|
79
79
|
'unsuccessful status'
|
80
|
-
)
|
80
|
+
),
|
81
|
+
'log message'
|
81
82
|
)
|
82
83
|
end
|
83
84
|
|
84
85
|
it_reports <<~'STR'
|
85
|
-
Killfork exited nonzero. Its result (if any) was ignored
|
86
|
+
Killfork exited nonzero. Its result (if any) was ignored.
|
87
|
+
Process status:
|
86
88
|
#<InstanceDouble(Process::Status) "unsuccessful status">
|
89
|
+
Log messages (combined stderr and stdout):
|
90
|
+
log message
|
87
91
|
STR
|
88
92
|
end
|
89
93
|
|
@@ -97,7 +101,8 @@ RSpec.describe Mutant::Reporter::CLI::Printer::IsolationResult do
|
|
97
101
|
instance_double(
|
98
102
|
Process::Status,
|
99
103
|
'unsuccessful status'
|
100
|
-
)
|
104
|
+
),
|
105
|
+
'log message'
|
101
106
|
)
|
102
107
|
end
|
103
108
|
|
@@ -116,8 +121,11 @@ RSpec.describe Mutant::Reporter::CLI::Printer::IsolationResult do
|
|
116
121
|
Possible solutions are:
|
117
122
|
* Reduce concurrency
|
118
123
|
* Reduce locks
|
119
|
-
Killfork exited nonzero. Its result (if any) was ignored
|
124
|
+
Killfork exited nonzero. Its result (if any) was ignored.
|
125
|
+
Process status:
|
120
126
|
#<InstanceDouble(Process::Status) "unsuccessful status">
|
127
|
+
Log messages (combined stderr and stdout):
|
128
|
+
log message
|
121
129
|
STR
|
122
130
|
end
|
123
131
|
end
|
@@ -12,7 +12,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:mutation_a_isolation_result) do
|
15
|
-
Mutant::Isolation::Fork::ChildError.new(status)
|
15
|
+
Mutant::Isolation::Fork::ChildError.new(status, 'log message')
|
16
16
|
end
|
17
17
|
|
18
18
|
it_reports(<<~'REPORT')
|
@@ -20,8 +20,12 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|
20
20
|
@@ -1,2 +1,2 @@
|
21
21
|
-true
|
22
22
|
+false
|
23
|
-
|
23
|
+
-----------------------
|
24
|
+
Killfork exited nonzero. Its result (if any) was ignored.
|
25
|
+
Process status:
|
24
26
|
#<InstanceDouble(Process::Status) (anonymous)>
|
27
|
+
Log messages (combined stderr and stdout):
|
28
|
+
log message
|
25
29
|
-----------------------
|
26
30
|
REPORT
|
27
31
|
end
|
@@ -42,6 +46,11 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|
42
46
|
[Mutant::Color::NONE, "@@ -1,2 +1,2 @@\n"],
|
43
47
|
[Mutant::Color::RED, "-true\n"],
|
44
48
|
[Mutant::Color::GREEN, "+false\n"],
|
49
|
+
[Mutant::Color::NONE, "-----------------------\n"],
|
50
|
+
[Mutant::Color::NONE, "- 1 @ runtime: 1.0\n"],
|
51
|
+
[Mutant::Color::NONE, " - test-a\n"],
|
52
|
+
[Mutant::Color::NONE, "Test Output:\n"],
|
53
|
+
[Mutant::Color::NONE, "mutation a test result output\n"],
|
45
54
|
[Mutant::Color::NONE, "-----------------------\n"]
|
46
55
|
].map { |color, text| color.format(text) }.join
|
47
56
|
)
|
@@ -54,6 +63,11 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|
54
63
|
-true
|
55
64
|
+false
|
56
65
|
-----------------------
|
66
|
+
- 1 @ runtime: 1.0
|
67
|
+
- test-a
|
68
|
+
Test Output:
|
69
|
+
mutation a test result output
|
70
|
+
-----------------------
|
57
71
|
STR
|
58
72
|
end
|
59
73
|
end
|
@@ -80,6 +94,11 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|
80
94
|
Mutated AST:
|
81
95
|
s(:zsuper)
|
82
96
|
-----------------------
|
97
|
+
- 1 @ runtime: 1.0
|
98
|
+
- test-a
|
99
|
+
Test Output:
|
100
|
+
mutation a test result output
|
101
|
+
-----------------------
|
83
102
|
REPORT
|
84
103
|
end
|
85
104
|
end
|
@@ -101,6 +120,11 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|
101
120
|
Unparsed Source:
|
102
121
|
true
|
103
122
|
-----------------------
|
123
|
+
- 1 @ runtime: 1.0
|
124
|
+
- test-a
|
125
|
+
Test Output:
|
126
|
+
mutation a test result output
|
127
|
+
-----------------------
|
104
128
|
REPORT
|
105
129
|
end
|
106
130
|
|
@@ -117,6 +141,11 @@ RSpec.describe Mutant::Reporter::CLI::Printer::MutationResult do
|
|
117
141
|
No code was inserted. And the test did NOT PASS.
|
118
142
|
This is typically a problem of your specs not passing unmutated.
|
119
143
|
-----------------------
|
144
|
+
- 1 @ runtime: 1.0
|
145
|
+
- test-a
|
146
|
+
Test Output:
|
147
|
+
mutation a test result output
|
148
|
+
-----------------------
|
120
149
|
REPORT
|
121
150
|
end
|
122
151
|
end
|
@@ -10,7 +10,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::StatusProgressive do
|
|
10
10
|
with(:env_result) { { subject_results: [] } }
|
11
11
|
|
12
12
|
it_reports <<~REPORT
|
13
|
-
|
13
|
+
progress: 00/02 alive: 0 runtime: 4.00s killtime: 0.00s mutations/s: 0.00
|
14
14
|
REPORT
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::StatusProgressive do
|
|
19
19
|
with(:status) { { active_jobs: [].to_set } }
|
20
20
|
|
21
21
|
it_reports(<<~REPORT)
|
22
|
-
|
22
|
+
progress: 02/02 alive: 0 runtime: 4.00s killtime: 2.00s mutations/s: 0.50
|
23
23
|
REPORT
|
24
24
|
end
|
25
25
|
|
@@ -30,13 +30,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::StatusProgressive do
|
|
30
30
|
with(:mutation_a_test_result) { { passed: true } }
|
31
31
|
|
32
32
|
it_reports(<<~REPORT)
|
33
|
-
|
33
|
+
progress: 02/02 alive: 1 runtime: 4.00s killtime: 2.00s mutations/s: 0.50
|
34
34
|
REPORT
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'on success' do
|
38
38
|
it_reports(<<~REPORT)
|
39
|
-
|
39
|
+
progress: 02/02 alive: 0 runtime: 4.00s killtime: 2.00s mutations/s: 0.50
|
40
40
|
REPORT
|
41
41
|
end
|
42
42
|
end
|
@@ -4,30 +4,12 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
4
4
|
setup_shared_context
|
5
5
|
|
6
6
|
let(:object) { described_class.new(output, format) }
|
7
|
+
let(:tty?) { false }
|
7
8
|
|
8
|
-
let(:
|
9
|
-
|
10
|
-
Mutant::Reporter::CLI::Tput,
|
11
|
-
restore: '[tput-restore]',
|
12
|
-
prepare: '[tput-prepare]'
|
13
|
-
)
|
9
|
+
let(:format) do
|
10
|
+
described_class::Format::Progressive.new(tty?)
|
14
11
|
end
|
15
12
|
|
16
|
-
let(:framed_format) do
|
17
|
-
described_class::Format::Framed.new(
|
18
|
-
tty: false,
|
19
|
-
tput: tput
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:tty?) { false }
|
24
|
-
|
25
|
-
let(:progressive_format) do
|
26
|
-
described_class::Format::Progressive.new(tty: tty?)
|
27
|
-
end
|
28
|
-
|
29
|
-
let(:format) { framed_format }
|
30
|
-
|
31
13
|
def contents
|
32
14
|
output.rewind
|
33
15
|
output.read
|
@@ -47,56 +29,23 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
47
29
|
describe '.build' do
|
48
30
|
subject { described_class.build(output) }
|
49
31
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
let(:framed_format) do
|
55
|
-
described_class::Format::Framed.new(
|
56
|
-
tty: true,
|
57
|
-
tput: tput
|
58
|
-
)
|
59
|
-
end
|
32
|
+
context 'when output is a tty' do
|
33
|
+
let(:tty?) { true }
|
34
|
+
let(:output) { instance_double(IO, tty?: true) }
|
60
35
|
|
61
|
-
|
62
|
-
expect(ENV).to receive(:key?).with('CI').and_return(ci?)
|
36
|
+
it { should eql(described_class.new(output, format)) }
|
63
37
|
end
|
64
38
|
|
65
|
-
|
66
|
-
|
67
|
-
|
39
|
+
context 'when output is not a tty' do
|
40
|
+
context 'and does not respond to #tty?' do
|
41
|
+
let(:output) { nil }
|
68
42
|
|
69
|
-
|
70
|
-
before do
|
71
|
-
expect(described_class::Tput).to receive(:detect).and_return(tput)
|
43
|
+
it { should eql(described_class.new(output, format)) }
|
72
44
|
end
|
73
45
|
|
74
|
-
context 'and
|
75
|
-
it { should eql(described_class.new(output,
|
46
|
+
context 'and does respond to #tty?' do
|
47
|
+
it { should eql(described_class.new(output, format)) }
|
76
48
|
end
|
77
|
-
|
78
|
-
context 'and tput is not available' do
|
79
|
-
let(:tput) { nil }
|
80
|
-
|
81
|
-
it { should eql(described_class.new(output, progressive_format)) }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'when on CI' do
|
86
|
-
let(:ci?) { true }
|
87
|
-
it { should eql(described_class.new(output, progressive_format)) }
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'when output is not a tty?' do
|
91
|
-
let(:tty?) { false }
|
92
|
-
it { should eql(described_class.new(output, progressive_format)) }
|
93
|
-
end
|
94
|
-
|
95
|
-
context 'when output does not respond to #tty?' do
|
96
|
-
let(:output) { instance_double(IO) }
|
97
|
-
let(:tty?) { false }
|
98
|
-
|
99
|
-
it { should eql(described_class.new(output, progressive_format)) }
|
100
49
|
end
|
101
50
|
end
|
102
51
|
|
@@ -111,41 +60,41 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
111
60
|
describe '#delay' do
|
112
61
|
subject { object.delay }
|
113
62
|
|
114
|
-
it { should eql(0
|
63
|
+
it { should eql(1.0) }
|
115
64
|
end
|
116
65
|
|
117
66
|
describe '#start' do
|
118
67
|
subject { object.start(env) }
|
119
68
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
context 'on framed format' do
|
134
|
-
it_reports '[tput-prepare]'
|
135
|
-
end
|
69
|
+
it_reports(<<~REPORT)
|
70
|
+
Mutant environment:
|
71
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
72
|
+
Integration: null
|
73
|
+
Jobs: 1
|
74
|
+
Includes: []
|
75
|
+
Requires: []
|
76
|
+
Subjects: 1
|
77
|
+
Total-Tests: 1
|
78
|
+
Selected-Tests: 1
|
79
|
+
Tests/Subject: 1.00 avg
|
80
|
+
Mutations: 2
|
81
|
+
REPORT
|
136
82
|
end
|
137
83
|
|
138
84
|
describe '#report' do
|
139
85
|
subject { object.report(env_result) }
|
140
86
|
|
141
87
|
it_reports(<<~REPORT)
|
142
|
-
Mutant
|
88
|
+
Mutant environment:
|
143
89
|
Matcher: #<Mutant::Matcher::Config empty>
|
144
|
-
Integration:
|
90
|
+
Integration: null
|
145
91
|
Jobs: 1
|
146
92
|
Includes: []
|
147
93
|
Requires: []
|
148
94
|
Subjects: 1
|
95
|
+
Total-Tests: 1
|
96
|
+
Selected-Tests: 1
|
97
|
+
Tests/Subject: 1.00 avg
|
149
98
|
Mutations: 2
|
150
99
|
Results: 2
|
151
100
|
Kills: 2
|
@@ -161,53 +110,27 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
161
110
|
describe '#progress' do
|
162
111
|
subject { object.progress(status) }
|
163
112
|
|
164
|
-
context '
|
165
|
-
|
166
|
-
|
167
|
-
it_reports(<<~REPORT)
|
168
|
-
[tput-restore]Mutant configuration:
|
169
|
-
Matcher: #<Mutant::Matcher::Config empty>
|
170
|
-
Integration: Mutant::Integration::Null
|
171
|
-
Jobs: 1
|
172
|
-
Includes: []
|
173
|
-
Requires: []
|
174
|
-
Subjects: 1
|
175
|
-
Mutations: 2
|
176
|
-
Results: 2
|
177
|
-
Kills: 2
|
178
|
-
Alive: 0
|
179
|
-
Runtime: 4.00s
|
180
|
-
Killtime: 2.00s
|
181
|
-
Overhead: 100.00%
|
182
|
-
Mutations/s: 0.50
|
183
|
-
Coverage: 100.00%
|
184
|
-
Active subjects: 0
|
185
|
-
REPORT
|
186
|
-
end
|
113
|
+
context 'with empty scheduler' do
|
114
|
+
with(:env_result) { { subject_results: [] } }
|
187
115
|
|
188
|
-
|
189
|
-
let(:format) { progressive_format }
|
116
|
+
let(:tty?) { true }
|
190
117
|
|
191
|
-
|
192
|
-
|
118
|
+
# rubocop:disable Metrics/LineLength
|
119
|
+
it_reports Mutant::Color::GREEN.format('progress: 00/02 alive: 0 runtime: 4.00s killtime: 0.00s mutations/s: 0.00') + "\n"
|
120
|
+
# rubocop:enable Metrics/LineLength
|
121
|
+
end
|
193
122
|
|
194
|
-
|
123
|
+
context 'with last mutation present' do
|
124
|
+
with(:env_result) { { subject_results: [subject_a_result] } }
|
195
125
|
|
196
|
-
|
126
|
+
context 'when mutation is successful' do
|
127
|
+
it_reports "progress: 02/02 alive: 0 runtime: 4.00s killtime: 2.00s mutations/s: 0.50\n"
|
197
128
|
end
|
198
129
|
|
199
|
-
context '
|
200
|
-
with(:
|
201
|
-
|
202
|
-
context 'when mutation is successful' do
|
203
|
-
it_reports "(02/02) 100% - killtime: 2.00s runtime: 4.00s overhead: 2.00s\n"
|
204
|
-
end
|
205
|
-
|
206
|
-
context 'when mutation is NOT successful' do
|
207
|
-
with(:mutation_a_test_result) { { passed: true } }
|
130
|
+
context 'when mutation is NOT successful' do
|
131
|
+
with(:mutation_a_test_result) { { passed: true } }
|
208
132
|
|
209
|
-
|
210
|
-
end
|
133
|
+
it_reports "progress: 02/02 alive: 1 runtime: 4.00s killtime: 2.00s mutations/s: 0.50\n"
|
211
134
|
end
|
212
135
|
end
|
213
136
|
end
|