danger-jacoco-instacart 0.1.12.SNAPSHOT.1 → 0.1.13.SNAPSHOT.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.
- checksums.yaml +4 -4
- data/.yardoc/checksums +2 -2
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/lib/jacoco/gem_version.rb +1 -1
- data/lib/jacoco/plugin.rb +15 -26
- data/spec/jacoco_spec.rb +77 -47
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f29acbe4cffe4ddeae3ab9f829a1dc5310da2f837aa8afd313d3cd16ddd63ad6
|
4
|
+
data.tar.gz: f74387bb9bb4307342e9baff55c011d52d2e06281bf86decfbd858f6962854f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 591ee3b4094f83a2f69e152b4d5f956a1402f3ee84c932287389aa017065743c3e88017c1979b043044e6961991be05da0ca6ad74ad26f13c726ef14ea24eae3
|
7
|
+
data.tar.gz: 130a3e11af52b5598603edeed78e57a6039528e7bf38f7cebdd9b8427cbf7d83f3654c572a17a89e1b5329d343a59e7f1cb22a9e7df18c04e097bd4f9cf368b3
|
data/.yardoc/checksums
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/danger_jacoco.rb 38229d934b3315bb2a5a4eec18eb65f3c54d304f
|
2
|
-
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/gem_version.rb
|
3
|
-
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/plugin.rb
|
2
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/gem_version.rb 8f31621c2d22f454fcaacb2640694c9c6e7f1fb8
|
3
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/plugin.rb e0262efb6d2458fa4ad4e2138c1f8a10fb11a1de
|
4
4
|
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/sax_parser.rb 370e2799f8dbdf7d642c820214e6ea84c30c9cb0
|
5
5
|
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/counter.rb 368f4a9811617b7a174ddf837a8fac49a4bc32a6
|
6
6
|
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/report.rb 7cf45ee71ff347a130320f6190ddb25525c7095d
|
data/.yardoc/object_types
CHANGED
Binary file
|
data/.yardoc/objects/root.dat
CHANGED
Binary file
|
data/lib/jacoco/gem_version.rb
CHANGED
data/lib/jacoco/plugin.rb
CHANGED
@@ -21,16 +21,17 @@ module Danger
|
|
21
21
|
#
|
22
22
|
class DangerJacoco < Plugin # rubocop:disable Metrics/ClassLength
|
23
23
|
attr_accessor :minimum_project_coverage_percentage, :minimum_class_coverage_percentage,
|
24
|
-
:minimum_composable_class_coverage_percentage, :
|
24
|
+
:minimum_composable_class_coverage_percentage, :files_to_check, :files_extension,
|
25
25
|
:minimum_package_coverage_map, :minimum_class_coverage_map, :fail_no_coverage_data_found,
|
26
|
-
:title, :class_column_title, :subtitle_success, :subtitle_failure
|
26
|
+
:title, :class_column_title, :subtitle_success, :subtitle_failure, :file_to_create_on_failure
|
27
27
|
|
28
28
|
# Initialize the plugin with configured parameters or defaults
|
29
29
|
def setup
|
30
30
|
setup_minimum_coverages
|
31
31
|
setup_texts
|
32
|
-
@
|
32
|
+
@files_to_check = [] unless files_to_check
|
33
33
|
@files_extension = ['.kt', '.java'] unless files_extension
|
34
|
+
@file_to_create_on_failure = 'danger_jacoco_failure_status_file.txt' unless file_to_create_on_failure
|
34
35
|
end
|
35
36
|
|
36
37
|
# Initialize the plugin with configured optional texts
|
@@ -102,13 +103,9 @@ module Danger
|
|
102
103
|
end
|
103
104
|
# rubocop:enable Style/AbcSize
|
104
105
|
|
105
|
-
# Select either only added files or modified and added files in this PR,
|
106
|
-
# depending on "only_check_new_files" attribute
|
107
106
|
def classes(delimiter)
|
108
|
-
git = @dangerfile.git
|
109
|
-
affected_files = only_check_new_files ? git.added_files : git.added_files + git.modified_files
|
110
107
|
class_to_file_path_hash = {}
|
111
|
-
|
108
|
+
files_to_check.select { |file| files_extension.reduce(false) { |state, el| state || file.end_with?(el) } }
|
112
109
|
.each do |file| # "src/java/com/example/CachedRepository.java"
|
113
110
|
classname = file.split('.').first.split(delimiter)[1] # "com/example/CachedRepository"
|
114
111
|
class_to_file_path_hash[classname] = file
|
@@ -227,29 +224,28 @@ module Danger
|
|
227
224
|
|
228
225
|
# rubocop:disable Style/SignalException
|
229
226
|
def report_fails(class_coverage_above_minimum, total_covered)
|
230
|
-
total_failure_message = ''
|
231
227
|
if total_covered[:covered] < minimum_project_coverage_percentage
|
232
228
|
# fail danger if total coverage is smaller than minimum_project_coverage_percentage
|
233
229
|
covered = total_covered[:covered]
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
# rubocop:disable Lint/UnreachableCode (rubocop mistakenly thinks that raise is unreachable since priorly called "fail" raises by itself, but in fact "fail" is caught and handled)
|
238
|
-
raise CoverageRequirementsNotMetError, total_failure_message if class_coverage_above_minimum
|
230
|
+
fail("Total coverage of #{covered}%. Improve this to at least #{minimum_project_coverage_percentage}%")
|
231
|
+
# rubocop:disable Lint/UnreachableCode (rubocop mistakenly thinks that this line is unreachable since priorly called "fail" raises an error, but in fact "fail" is caught and handled)
|
232
|
+
create_status_file_on_failure if class_coverage_above_minimum
|
239
233
|
# rubocop:enable Lint/UnreachableCode
|
240
234
|
end
|
241
235
|
|
242
236
|
return if class_coverage_above_minimum
|
243
237
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
# rubocop:disable Lint/UnreachableCode (rubocop mistakenly thinks that raise is unreachable since priorly called "fail" raises by itself, but in fact "fail" is caught and handled)
|
248
|
-
raise CoverageRequirementsNotMetError, "#{total_failure_message}. #{class_failure_message}"
|
238
|
+
fail("Class coverage is below minimum. Improve to at least #{minimum_class_coverage_percentage}%")
|
239
|
+
# rubocop:disable Lint/UnreachableCode (rubocop mistakenly thinks that this line is unreachable since priorly called "fail" raises an error, but in fact "fail" is caught and handled)
|
240
|
+
create_status_file_on_failure
|
249
241
|
# rubocop:enable Lint/UnreachableCode
|
250
242
|
end
|
251
243
|
# rubocop:enable Style/SignalException
|
252
244
|
|
245
|
+
def create_status_file_on_failure
|
246
|
+
File.open(file_to_create_on_failure, 'w') {}
|
247
|
+
end
|
248
|
+
|
253
249
|
def markdown_class(parser, report_markdown, report_url, class_to_file_path_hash)
|
254
250
|
class_coverage_above_minimum = true
|
255
251
|
parser.classes.each do |jacoco_class| # Check metrics for each classes
|
@@ -275,10 +271,3 @@ module Danger
|
|
275
271
|
end
|
276
272
|
end
|
277
273
|
end
|
278
|
-
|
279
|
-
# Exception that is being thrown when any of the coverage requirements aren't met
|
280
|
-
class CoverageRequirementsNotMetError < StandardError
|
281
|
-
def initialize(msg = 'Coverage requirements not met')
|
282
|
-
super
|
283
|
-
end
|
284
|
-
end
|
data/spec/jacoco_spec.rb
CHANGED
@@ -20,20 +20,17 @@ module Danger
|
|
20
20
|
@dangerfile = testing_dangerfile
|
21
21
|
@my_plugin = @dangerfile.jacoco
|
22
22
|
|
23
|
-
|
24
|
-
added_files = ['src/java/io/sample/UseCase.java']
|
25
|
-
|
26
|
-
allow(@dangerfile.git).to receive(:modified_files).and_return(modified_files)
|
27
|
-
allow(@dangerfile.git).to receive(:added_files).and_return(added_files)
|
23
|
+
allow(File).to receive(:open).and_call_original
|
28
24
|
end
|
29
25
|
|
30
26
|
it :report do
|
31
27
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
32
28
|
|
29
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
33
30
|
@my_plugin.minimum_project_coverage_percentage = 50
|
34
31
|
@my_plugin.minimum_class_coverage_map = { 'com/example/CachedRepository' => 100 }
|
35
32
|
|
36
|
-
|
33
|
+
@my_plugin.report path_a
|
37
34
|
|
38
35
|
expect(@dangerfile.status_report[:errors]).to eq(['Total coverage of 32.9%. Improve this to at least 50%',
|
39
36
|
'Class coverage is below minimum. Improve to at least 0%'])
|
@@ -43,55 +40,97 @@ module Danger
|
|
43
40
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 100% | :warning: |')
|
44
41
|
end
|
45
42
|
|
43
|
+
it 'creates supplied status file upon failure' do
|
44
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
45
|
+
|
46
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
47
|
+
@my_plugin.minimum_project_coverage_percentage = 100
|
48
|
+
@my_plugin.minimum_class_coverage_percentage = 60
|
49
|
+
@my_plugin.file_to_create_on_failure = 'kmm.txt'
|
50
|
+
|
51
|
+
expect(File).to receive(:open).with('kmm.txt', 'w')
|
52
|
+
@my_plugin.report path_a
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'creates default status file upon failure' do
|
56
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
57
|
+
|
58
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
59
|
+
@my_plugin.minimum_class_coverage_percentage = 60
|
60
|
+
|
61
|
+
expect(File).to receive(:open).with('danger_jacoco_failure_status_file.txt', 'w')
|
62
|
+
@my_plugin.report path_a
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'does _not_ create status file upon success' do
|
66
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
67
|
+
|
68
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
69
|
+
@my_plugin.minimum_class_coverage_percentage = 40
|
70
|
+
@my_plugin.file_to_create_on_failure = 'kmm.txt'
|
71
|
+
|
72
|
+
expect(File).to_not receive(:open).with('kmm.txt', 'w')
|
73
|
+
@my_plugin.report path_a
|
74
|
+
end
|
75
|
+
|
46
76
|
it 'test regex class coverage' do
|
47
77
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
48
78
|
|
79
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
49
80
|
@my_plugin.minimum_project_coverage_percentage = 50
|
50
81
|
@my_plugin.minimum_class_coverage_map = { '.*Repository' => 60 }
|
51
82
|
|
52
|
-
|
83
|
+
@my_plugin.report path_a
|
84
|
+
|
53
85
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 60% | :warning: |')
|
54
86
|
end
|
55
87
|
|
56
88
|
it 'test with package coverage' do
|
57
89
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
58
90
|
|
91
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
59
92
|
@my_plugin.minimum_project_coverage_percentage = 50
|
60
93
|
@my_plugin.minimum_package_coverage_map = { 'com/example/' => 70 }
|
61
94
|
|
62
|
-
|
95
|
+
@my_plugin.report path_a
|
96
|
+
|
63
97
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 70% | :warning: |')
|
64
98
|
end
|
65
99
|
|
66
100
|
it 'test with bigger overlapped package coverage' do
|
67
101
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
68
102
|
|
103
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
69
104
|
@my_plugin.minimum_project_coverage_percentage = 50
|
70
105
|
@my_plugin.minimum_package_coverage_map = {
|
71
106
|
'com/example/' => 70,
|
72
107
|
'com/' => 90
|
73
108
|
}
|
74
109
|
|
75
|
-
|
110
|
+
@my_plugin.report path_a
|
111
|
+
|
76
112
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 70% | :warning: |')
|
77
113
|
end
|
78
114
|
|
79
115
|
it 'test with lower overlapped package coverage' do
|
80
116
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
81
117
|
|
118
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
82
119
|
@my_plugin.minimum_project_coverage_percentage = 50
|
83
120
|
@my_plugin.minimum_package_coverage_map = {
|
84
121
|
'com/example/' => 77,
|
85
122
|
'com/' => 30
|
86
123
|
}
|
87
124
|
|
88
|
-
|
125
|
+
@my_plugin.report path_a
|
126
|
+
|
89
127
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 77% | :warning: |')
|
90
128
|
end
|
91
129
|
|
92
130
|
it 'test with overlapped package coverage and bigger class coverage' do
|
93
131
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
94
132
|
|
133
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
95
134
|
@my_plugin.minimum_project_coverage_percentage = 50
|
96
135
|
@my_plugin.minimum_package_coverage_map = {
|
97
136
|
'com/example/' => 77,
|
@@ -99,13 +138,15 @@ module Danger
|
|
99
138
|
}
|
100
139
|
@my_plugin.minimum_class_coverage_map = { 'com/example/CachedRepository' => 100 }
|
101
140
|
|
102
|
-
|
141
|
+
@my_plugin.report path_a
|
142
|
+
|
103
143
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 100% | :warning: |')
|
104
144
|
end
|
105
145
|
|
106
146
|
it 'test with overlapped package coverage and lower class coverage' do
|
107
147
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
108
148
|
|
149
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
109
150
|
@my_plugin.minimum_project_coverage_percentage = 50
|
110
151
|
@my_plugin.minimum_package_coverage_map = {
|
111
152
|
'com/example/' => 90,
|
@@ -113,28 +154,15 @@ module Danger
|
|
113
154
|
}
|
114
155
|
@my_plugin.minimum_class_coverage_map = { 'com/example/CachedRepository' => 80 }
|
115
156
|
|
116
|
-
expect { @my_plugin.report(path_a) }.to raise_error(CoverageRequirementsNotMetError, /Total coverage of 32.9%. Improve this to at least 50%/)
|
117
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 80% | :warning: |')
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'checks modified files when "only_check_new_files" attribute is false' do
|
121
|
-
path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
|
122
|
-
|
123
|
-
@my_plugin.minimum_project_coverage_percentage = 50
|
124
|
-
@my_plugin.only_check_new_files = false
|
125
|
-
|
126
157
|
@my_plugin.report path_a
|
127
158
|
|
128
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('
|
129
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
|
130
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('|:---|:---:|:---:|:---:|')
|
131
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 0% | :white_check_mark: |')
|
132
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 0% | :white_check_mark: |')
|
159
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 80% | :warning: |')
|
133
160
|
end
|
134
161
|
|
135
162
|
it 'defaults "only_check_new_files" attribute to false' do
|
136
163
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
|
137
164
|
|
165
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
138
166
|
@my_plugin.minimum_project_coverage_percentage = 50
|
139
167
|
|
140
168
|
@my_plugin.report path_a
|
@@ -143,35 +171,22 @@ module Danger
|
|
143
171
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 0% | :white_check_mark: |')
|
144
172
|
end
|
145
173
|
|
146
|
-
it 'does _not_ check modified files when "only_check_new_files" attribute is true' do
|
147
|
-
path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
|
148
|
-
|
149
|
-
@my_plugin.minimum_project_coverage_percentage = 50
|
150
|
-
@my_plugin.minimum_class_coverage_percentage = 70
|
151
|
-
@my_plugin.only_check_new_files = true
|
152
|
-
|
153
|
-
expect { @my_plugin.report(path_a) }.to raise_error(CoverageRequirementsNotMetError, /Class coverage is below minimum. Improve to at least 70%/)
|
154
|
-
|
155
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('### JaCoCo Code Coverage 55.59% :white_check_mark:')
|
156
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
|
157
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('|:---|:---:|:---:|:---:|')
|
158
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 70% | :warning: |')
|
159
|
-
expect(@dangerfile.status_report[:markdowns][0].message).not_to include('com/example/CachedRepository')
|
160
|
-
end
|
161
|
-
|
162
174
|
it 'adds a link to report' do
|
163
175
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
164
176
|
|
177
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
165
178
|
@my_plugin.minimum_class_coverage_percentage = 80
|
166
179
|
@my_plugin.minimum_project_coverage_percentage = 50
|
167
180
|
|
168
|
-
|
181
|
+
@my_plugin.report(path_a, 'http://test.com/')
|
182
|
+
|
169
183
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| [`com/example/CachedRepository`](http://test.com/com.example/CachedRepository.html) | 50% | 80% | :warning: |')
|
170
184
|
end
|
171
185
|
|
172
186
|
it 'When option "fail_no_coverage_data_found" is set to optionally fail, it doesn\'t fail the execution' do
|
173
187
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
174
188
|
|
189
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
175
190
|
@my_plugin.minimum_class_coverage_percentage = 80
|
176
191
|
@my_plugin.minimum_project_coverage_percentage = 50
|
177
192
|
|
@@ -181,6 +196,7 @@ module Danger
|
|
181
196
|
it 'When option "fail_no_coverage_data_found" is not set, the execution fails on empty data' do
|
182
197
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_b.xml"
|
183
198
|
|
199
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
184
200
|
@my_plugin.minimum_class_coverage_percentage = 80
|
185
201
|
@my_plugin.minimum_project_coverage_percentage = 50
|
186
202
|
|
@@ -190,6 +206,7 @@ module Danger
|
|
190
206
|
it 'When option "fail_no_coverage_data_found" is set to optionally fail, the execution fails on empty data' do
|
191
207
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_b.xml"
|
192
208
|
|
209
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
193
210
|
@my_plugin.minimum_class_coverage_percentage = 80
|
194
211
|
@my_plugin.minimum_project_coverage_percentage = 50
|
195
212
|
|
@@ -199,6 +216,7 @@ module Danger
|
|
199
216
|
it 'When option "fail_no_coverage_data_found" is set to optionally warn (not fail), the execution doesn\'t fail on empty data' do
|
200
217
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_b.xml"
|
201
218
|
|
219
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
202
220
|
@my_plugin.minimum_class_coverage_percentage = 80
|
203
221
|
@my_plugin.minimum_project_coverage_percentage = 50
|
204
222
|
|
@@ -208,6 +226,7 @@ module Danger
|
|
208
226
|
it 'prints default success subtitle' do
|
209
227
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
210
228
|
|
229
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
211
230
|
@my_plugin.minimum_project_coverage_percentage = 30
|
212
231
|
@my_plugin.minimum_class_coverage_percentage = 40
|
213
232
|
|
@@ -224,10 +243,11 @@ module Danger
|
|
224
243
|
it 'prints default failure subtitle' do
|
225
244
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
226
245
|
|
246
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
227
247
|
@my_plugin.minimum_project_coverage_percentage = 30
|
228
248
|
@my_plugin.minimum_class_coverage_percentage = 60
|
229
249
|
|
230
|
-
|
250
|
+
@my_plugin.report path_a
|
231
251
|
|
232
252
|
expected = "### JaCoCo Code Coverage 32.9% :white_check_mark:\n"
|
233
253
|
expected += "#### There are classes that do not meet coverage requirement :warning:\n"
|
@@ -240,6 +260,7 @@ module Danger
|
|
240
260
|
it 'prints custom success subtitle' do
|
241
261
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
242
262
|
|
263
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
243
264
|
@my_plugin.minimum_project_coverage_percentage = 30
|
244
265
|
@my_plugin.minimum_class_coverage_percentage = 40
|
245
266
|
@my_plugin.subtitle_success = 'You rock! 🔥'
|
@@ -257,11 +278,12 @@ module Danger
|
|
257
278
|
it 'prints custom failure subtitle' do
|
258
279
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
259
280
|
|
281
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
260
282
|
@my_plugin.minimum_project_coverage_percentage = 30
|
261
283
|
@my_plugin.minimum_class_coverage_percentage = 60
|
262
284
|
@my_plugin.subtitle_failure = 'Too bad :('
|
263
285
|
|
264
|
-
|
286
|
+
@my_plugin.report path_a
|
265
287
|
|
266
288
|
expected = "### JaCoCo Code Coverage 32.9% :white_check_mark:\n"
|
267
289
|
expected += "#### Too bad :(\n"
|
@@ -274,6 +296,8 @@ module Danger
|
|
274
296
|
it 'prints default class column title' do
|
275
297
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
276
298
|
|
299
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
300
|
+
|
277
301
|
@my_plugin.report path_a
|
278
302
|
|
279
303
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
|
@@ -282,6 +306,7 @@ module Danger
|
|
282
306
|
it 'prints custom class column title' do
|
283
307
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
284
308
|
|
309
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
285
310
|
@my_plugin.class_column_title = 'New files'
|
286
311
|
|
287
312
|
@my_plugin.report path_a
|
@@ -292,6 +317,7 @@ module Danger
|
|
292
317
|
it 'instruction coverage takes over all the rest coverages for classes' do
|
293
318
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_d.xml"
|
294
319
|
|
320
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
295
321
|
@my_plugin.minimum_class_coverage_percentage = 50
|
296
322
|
|
297
323
|
@my_plugin.report path_a
|
@@ -302,9 +328,10 @@ module Danger
|
|
302
328
|
it 'branch coverage takes over line coverage for classes, when instruction coverage is not available' do
|
303
329
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_e.xml"
|
304
330
|
|
331
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
305
332
|
@my_plugin.minimum_class_coverage_percentage = 50
|
306
333
|
|
307
|
-
|
334
|
+
@my_plugin.report path_a
|
308
335
|
|
309
336
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 42% | 50% | :warning: |')
|
310
337
|
end
|
@@ -312,6 +339,7 @@ module Danger
|
|
312
339
|
it 'line coverage takes over for classes, when both instruction coverage and branch coverage are not available' do
|
313
340
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_f.xml"
|
314
341
|
|
342
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
315
343
|
@my_plugin.minimum_class_coverage_percentage = 50
|
316
344
|
|
317
345
|
@my_plugin.report path_a
|
@@ -328,6 +356,7 @@ module Danger
|
|
328
356
|
it 'applies minimum_composable_class_coverage_percentage' do
|
329
357
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
330
358
|
|
359
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
331
360
|
@my_plugin.minimum_class_coverage_percentage = 55
|
332
361
|
@my_plugin.minimum_composable_class_coverage_percentage = 45
|
333
362
|
|
@@ -346,10 +375,11 @@ module Danger
|
|
346
375
|
it 'does not apply minimum_composable_class_coverage_percentage' do
|
347
376
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
348
377
|
|
378
|
+
@my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
|
349
379
|
@my_plugin.minimum_class_coverage_percentage = 55
|
350
380
|
@my_plugin.minimum_composable_class_coverage_percentage = 45
|
351
381
|
|
352
|
-
|
382
|
+
@my_plugin.report path_a
|
353
383
|
|
354
384
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 55% | :warning: |')
|
355
385
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-jacoco-instacart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13.SNAPSHOT.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Malinskiy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-09-
|
12
|
+
date: 2022-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: danger-plugin-api
|