danger-jacoco-instacart 0.1.9 → 0.1.10
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 +15 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/README.md +1 -0
- data/lib/jacoco/gem_version.rb +1 -1
- data/lib/jacoco/plugin.rb +31 -9
- data/spec/fixtures/output_c.xml +73 -0
- data/spec/jacoco_spec.rb +129 -3
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9360d314e746b8e23358b48545351a54693c9878bc1d50372e05e5993cd4436d
|
4
|
+
data.tar.gz: 2a07dd89fe99cf04811be5f2f5d7363cf6a08181bd397ffa99f2a235e2377f89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83392c62d27ccb28bfb4b345dc87e11e8f595e558c0339c50b592860c648b09c02e0a0830bb40f57fb1298f3f2c01b74fbfaa050892b15a3e62f66ce7f46d6ff
|
7
|
+
data.tar.gz: f64fc4aade681283072b6acc84c33ae9b2ecec84f0dec1d4bc19bcbc437a85e75175bf3d216a5fbad75e33fb8df8bf44a514380217eae4e99e825af8b8130d01
|
data/.yardoc/checksums
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/danger_jacoco.rb 38229d934b3315bb2a5a4eec18eb65f3c54d304f
|
2
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/gem_version.rb fc0b799df58ae240e5bc7ee0aeab413449d1b49f
|
3
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/plugin.rb faba0fa9900efd1df07bebd0571c4c9f02129b61
|
4
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/sax_parser.rb 370e2799f8dbdf7d642c820214e6ea84c30c9cb0
|
5
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/counter.rb 368f4a9811617b7a174ddf837a8fac49a4bc32a6
|
6
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/report.rb 7cf45ee71ff347a130320f6190ddb25525c7095d
|
7
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/class.rb 89c78fdda05e07a709ddfb1d5ae9fb2472eaa504
|
8
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/method.rb 37076c751eb37683c0071c154319b85a987a2708
|
9
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/group.rb 6a8ccb32c793842af49c5c2d0d015bf01b0ec537
|
10
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/sourcefile.rb 19ffc9500370f50807af91a6f177c42d5879aabd
|
11
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/session_info.rb 5c908a9f96bd054d202edfeb30f29dcb4b42a1c9
|
12
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/line.rb ff5d6fc5bf0bf808c46d4bafce0f3fc53c8fdd73
|
13
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/package.rb b865b8eca41323dfc832babc08179fb94b5dfb0f
|
14
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/dom_parser.rb d08e0ca8531dd04bc9261a57fc03852b23883965
|
15
|
+
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/danger_plugin.rb f5f82beb7e326604e1003f368e15da243263c0cf
|
data/.yardoc/complete
ADDED
File without changes
|
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/README.md
CHANGED
@@ -23,6 +23,7 @@ jacoco.minimum_class_coverage_map = { # optional (default is empty)
|
|
23
23
|
'com/package/more/specific/ClassName' => 15
|
24
24
|
}
|
25
25
|
jacoco.minimum_class_coverage_percentage = 75 # default 0
|
26
|
+
jacoco.only_check_new_files = true # default false
|
26
27
|
jacoco.files_extension = [".java"] # default [".kt", ".java"]
|
27
28
|
jacoco.report("path/to/jacoco.xml", "http://jacoco-html-reports/")
|
28
29
|
```
|
data/lib/jacoco/gem_version.rb
CHANGED
data/lib/jacoco/plugin.rb
CHANGED
@@ -20,17 +20,32 @@ module Danger
|
|
20
20
|
# @tags jacoco, coverage, java, android, kotlin
|
21
21
|
#
|
22
22
|
class DangerJacoco < Plugin # rubocop:disable Metrics/ClassLength
|
23
|
-
attr_accessor :minimum_project_coverage_percentage, :minimum_class_coverage_percentage, :
|
24
|
-
:
|
23
|
+
attr_accessor :minimum_project_coverage_percentage, :minimum_class_coverage_percentage, :only_check_new_files,
|
24
|
+
:files_extension, :minimum_package_coverage_map, :minimum_class_coverage_map,
|
25
|
+
:fail_no_coverage_data_found, :title, :class_column_title, :subtitle_success, :subtitle_failure
|
25
26
|
|
26
27
|
# Initialize the plugin with configured parameters or defaults
|
27
28
|
def setup
|
29
|
+
setup_minimum_coverages
|
30
|
+
setup_texts
|
31
|
+
@only_check_new_files = false unless only_check_new_files
|
32
|
+
@files_extension = ['.kt', '.java'] unless files_extension
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initialize the plugin with configured optional texts
|
36
|
+
def setup_texts
|
37
|
+
@title = 'JaCoCo' unless title
|
38
|
+
@class_column_title = 'Class' unless class_column_title
|
39
|
+
@subtitle_success = 'All classes meet coverage requirement. Well done! :white_check_mark:' unless subtitle_success
|
40
|
+
@subtitle_failure = 'There are classes that do not meet coverage requirement :warning:' unless subtitle_failure
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initialize the plugin with configured coverage minimum parameters or defaults
|
44
|
+
def setup_minimum_coverages
|
28
45
|
@minimum_project_coverage_percentage = 0 unless minimum_project_coverage_percentage
|
29
46
|
@minimum_class_coverage_percentage = 0 unless minimum_class_coverage_percentage
|
30
47
|
@minimum_package_coverage_map = {} unless minimum_package_coverage_map
|
31
48
|
@minimum_class_coverage_map = {} unless minimum_class_coverage_map
|
32
|
-
@files_extension = ['.kt', '.java'] unless files_extension
|
33
|
-
@title = 'JaCoCo' unless title
|
34
49
|
end
|
35
50
|
|
36
51
|
# Parses the xml output of jacoco to Ruby model classes
|
@@ -59,6 +74,7 @@ module Danger
|
|
59
74
|
# Java => blah/blah/java/slashed_package/Source.java
|
60
75
|
# Kotlin => blah/blah/kotlin/slashed_package/Source.kt
|
61
76
|
#
|
77
|
+
# rubocop:disable Style/AbcSize
|
62
78
|
def report(path, report_url = '', delimiter = %r{/java/|/kotlin/}, fail_no_coverage_data_found: true)
|
63
79
|
@fail_no_coverage_data_found = fail_no_coverage_data_found
|
64
80
|
|
@@ -70,19 +86,24 @@ module Danger
|
|
70
86
|
|
71
87
|
total_covered = total_coverage(path)
|
72
88
|
|
73
|
-
|
74
|
-
report_markdown
|
89
|
+
header = "### #{title} Code Coverage #{total_covered[:covered]}% #{total_covered[:status]}\n"
|
90
|
+
report_markdown = header
|
91
|
+
report_markdown += "| #{class_column_title} | Covered | Required | Status |\n"
|
75
92
|
report_markdown += "|:---|:---:|:---:|:---:|\n"
|
76
93
|
class_coverage_above_minimum = markdown_class(parser, report_markdown, report_url)
|
94
|
+
subtitle = class_coverage_above_minimum ? subtitle_success : subtitle_failure
|
95
|
+
report_markdown.insert(header.length, "#### #{subtitle}\n")
|
77
96
|
markdown(report_markdown)
|
78
97
|
|
79
98
|
report_fails(class_coverage_above_minimum, total_covered)
|
80
99
|
end
|
100
|
+
# rubocop:enable Style/AbcSize
|
81
101
|
|
82
|
-
# Select modified and added files in this PR
|
102
|
+
# Select either only added files or modified and added files in this PR,
|
103
|
+
# depending on "only_check_new_files" attribute
|
83
104
|
def classes(delimiter)
|
84
105
|
git = @dangerfile.git
|
85
|
-
affected_files = git.
|
106
|
+
affected_files = only_check_new_files ? git.added_files : git.added_files + git.modified_files
|
86
107
|
affected_files.select { |file| files_extension.reduce(false) { |state, el| state || file.end_with?(el) } }
|
87
108
|
.map { |file| file.split('.').first.split(delimiter)[1] }
|
88
109
|
end
|
@@ -138,7 +159,8 @@ module Danger
|
|
138
159
|
def coverage_status(coverage, minimum_percentage)
|
139
160
|
if coverage < (minimum_percentage / 2) then ':skull:'
|
140
161
|
elsif coverage < minimum_percentage then ':warning:'
|
141
|
-
else
|
162
|
+
else
|
163
|
+
':white_check_mark:'
|
142
164
|
end
|
143
165
|
end
|
144
166
|
|
@@ -0,0 +1,73 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.0//EN"
|
2
|
+
"report.dtd">
|
3
|
+
<report name="test_report">
|
4
|
+
<sessioninfo id="test-id" start="1480057517395" dump="1480057526412"/>
|
5
|
+
<package name="com/example">
|
6
|
+
<class name="com/example/CachedRepository">
|
7
|
+
<method name="<init>" desc="()V" line="17">
|
8
|
+
<counter type="INSTRUCTION" missed="0" covered="11"/>
|
9
|
+
<counter type="LINE" missed="0" covered="5"/>
|
10
|
+
<counter type="COMPLEXITY" missed="0" covered="1"/>
|
11
|
+
<counter type="METHOD" missed="0" covered="1"/>
|
12
|
+
</method>
|
13
|
+
<counter type="INSTRUCTION" missed="0" covered="46"/>
|
14
|
+
<counter type="LINE" missed="0" covered="14"/>
|
15
|
+
<counter type="COMPLEXITY" missed="5" covered="7"/>
|
16
|
+
<counter type="METHOD" missed="0" covered="7"/>
|
17
|
+
<counter type="CLASS" missed="0" covered="1"/>
|
18
|
+
<counter type="BRANCH" missed="2" covered="2" />
|
19
|
+
</class>
|
20
|
+
<sourcefile name="CachedRepository.java">
|
21
|
+
<line nr="16" mi="0" ci="2" mb="0" cb="0"/>
|
22
|
+
<line nr="17" mi="0" ci="3" mb="0" cb="0"/>
|
23
|
+
<counter type="INSTRUCTION" missed="2" covered="98"/>
|
24
|
+
<counter type="LINE" missed="2" covered="19"/>
|
25
|
+
<counter type="COMPLEXITY" missed="2" covered="11"/>
|
26
|
+
<counter type="METHOD" missed="2" covered="11"/>
|
27
|
+
<counter type="CLASS" missed="2" covered="4"/>
|
28
|
+
</sourcefile>
|
29
|
+
<counter type="INSTRUCTION" missed="80" covered="324"/>
|
30
|
+
<counter type="BRANCH" missed="4" covered="4"/>
|
31
|
+
<counter type="LINE" missed="24" covered="68"/>
|
32
|
+
<counter type="COMPLEXITY" missed="11" covered="39"/>
|
33
|
+
<counter type="METHOD" missed="9" covered="37"/>
|
34
|
+
<counter type="CLASS" missed="2" covered="10"/>
|
35
|
+
</package>
|
36
|
+
<package name="io/sample">
|
37
|
+
<class name="io/sample/UseCase">
|
38
|
+
<method name="<init>" desc="()V" line="17">
|
39
|
+
<counter type="INSTRUCTION" missed="3" covered="8"/>
|
40
|
+
<counter type="LINE" missed="0" covered="7"/>
|
41
|
+
<counter type="COMPLEXITY" missed="0" covered="1"/>
|
42
|
+
<counter type="METHOD" missed="0" covered="1"/>
|
43
|
+
</method>
|
44
|
+
<counter type="INSTRUCTION" missed="0" covered="36"/>
|
45
|
+
<counter type="LINE" missed="0" covered="12"/>
|
46
|
+
<counter type="COMPLEXITY" missed="5" covered="8"/>
|
47
|
+
<counter type="METHOD" missed="0" covered="9"/>
|
48
|
+
<counter type="CLASS" missed="0" covered="1"/>
|
49
|
+
<counter type="BRANCH" missed="1" covered="2" />
|
50
|
+
</class>
|
51
|
+
<sourcefile name="UseCase.java">
|
52
|
+
<line nr="16" mi="0" ci="2" mb="0" cb="0"/>
|
53
|
+
<line nr="17" mi="0" ci="3" mb="0" cb="0"/>
|
54
|
+
<counter type="INSTRUCTION" missed="2" covered="48"/>
|
55
|
+
<counter type="LINE" missed="2" covered="9"/>
|
56
|
+
<counter type="COMPLEXITY" missed="2" covered="8"/>
|
57
|
+
<counter type="METHOD" missed="2" covered="7"/>
|
58
|
+
<counter type="CLASS" missed="2" covered="4"/>
|
59
|
+
</sourcefile>
|
60
|
+
<counter type="INSTRUCTION" missed="101" covered="201"/>
|
61
|
+
<counter type="BRANCH" missed="4" covered="4"/>
|
62
|
+
<counter type="LINE" missed="54" covered="78"/>
|
63
|
+
<counter type="COMPLEXITY" missed="21" covered="29"/>
|
64
|
+
<counter type="METHOD" missed="9" covered="37"/>
|
65
|
+
<counter type="CLASS" missed="2" covered="10"/>
|
66
|
+
</package>
|
67
|
+
<counter type="INSTRUCTION" missed="39399" covered="49321"/>
|
68
|
+
<counter type="BRANCH" missed="3463" covered="4039"/>
|
69
|
+
<counter type="LINE" missed="9611" covered="9974"/>
|
70
|
+
<counter type="COMPLEXITY" missed="5517" covered="6444"/>
|
71
|
+
<counter type="METHOD" missed="3382" covered="4120"/>
|
72
|
+
<counter type="CLASS" missed="491" covered="570"/>
|
73
|
+
</report>
|
data/spec/jacoco_spec.rb
CHANGED
@@ -21,7 +21,7 @@ module Danger
|
|
21
21
|
@my_plugin = @dangerfile.jacoco
|
22
22
|
|
23
23
|
modified_files = ['src/java/com/example/CachedRepository.java']
|
24
|
-
added_files = ['src/java/
|
24
|
+
added_files = ['src/java/io/sample/UseCase.java']
|
25
25
|
|
26
26
|
allow(@dangerfile.git).to receive(:modified_files).and_return(modified_files)
|
27
27
|
allow(@dangerfile.git).to receive(:added_files).and_return(added_files)
|
@@ -38,7 +38,7 @@ module Danger
|
|
38
38
|
expect(@dangerfile.status_report[:errors]).to eq(['Total coverage of 32.9%. Improve this to at least 50%',
|
39
39
|
'Class coverage is below minimum. Improve to at least 0%'])
|
40
40
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('### JaCoCo Code Coverage 32.9% :warning:')
|
41
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered |
|
41
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
|
42
42
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('|:---|:---:|:---:|:---:|')
|
43
43
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 100% | :warning: |')
|
44
44
|
end
|
@@ -108,7 +108,7 @@ module Danger
|
|
108
108
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 100% | :warning: |')
|
109
109
|
end
|
110
110
|
|
111
|
-
it 'test with overlapped package coverage and
|
111
|
+
it 'test with overlapped package coverage and lower class coverage' do
|
112
112
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
113
113
|
|
114
114
|
@my_plugin.minimum_project_coverage_percentage = 50
|
@@ -123,6 +123,48 @@ module Danger
|
|
123
123
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 80% | :warning: |')
|
124
124
|
end
|
125
125
|
|
126
|
+
it 'checks modified files when "only_check_new_files" attribute is false' do
|
127
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
|
128
|
+
|
129
|
+
@my_plugin.minimum_project_coverage_percentage = 50
|
130
|
+
@my_plugin.only_check_new_files = false
|
131
|
+
|
132
|
+
@my_plugin.report path_a
|
133
|
+
|
134
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('### JaCoCo Code Coverage 55.59% :white_check_mark:')
|
135
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
|
136
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('|:---|:---:|:---:|:---:|')
|
137
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 0% | :white_check_mark: |')
|
138
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 0% | :white_check_mark: |')
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'defaults "only_check_new_files" attribute to false' do
|
142
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
|
143
|
+
|
144
|
+
@my_plugin.minimum_project_coverage_percentage = 50
|
145
|
+
|
146
|
+
@my_plugin.report path_a
|
147
|
+
|
148
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 0% | :white_check_mark: |')
|
149
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 0% | :white_check_mark: |')
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'does _not_ check modified files when "only_check_new_files" attribute is true' do
|
153
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
|
154
|
+
|
155
|
+
@my_plugin.minimum_project_coverage_percentage = 50
|
156
|
+
@my_plugin.minimum_class_coverage_percentage = 70
|
157
|
+
@my_plugin.only_check_new_files = true
|
158
|
+
|
159
|
+
@my_plugin.report path_a
|
160
|
+
|
161
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('### JaCoCo Code Coverage 55.59% :white_check_mark:')
|
162
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
|
163
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('|:---|:---:|:---:|:---:|')
|
164
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 70% | :warning: |')
|
165
|
+
expect(@dangerfile.status_report[:markdowns][0].message).not_to include('com/example/CachedRepository')
|
166
|
+
end
|
167
|
+
|
126
168
|
it 'adds a link to report' do
|
127
169
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
128
170
|
|
@@ -169,6 +211,90 @@ module Danger
|
|
169
211
|
|
170
212
|
expect { @my_plugin.report path_a, fail_no_coverage_data_found: false }.to_not raise_error(RuntimeError)
|
171
213
|
end
|
214
|
+
|
215
|
+
it 'prints default success subtitle' do
|
216
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
217
|
+
|
218
|
+
@my_plugin.minimum_project_coverage_percentage = 30
|
219
|
+
@my_plugin.minimum_class_coverage_percentage = 40
|
220
|
+
|
221
|
+
@my_plugin.report path_a
|
222
|
+
|
223
|
+
expected = "### JaCoCo Code Coverage 32.9% :white_check_mark:\n"
|
224
|
+
expected += "#### All classes meet coverage requirement. Well done! :white_check_mark:\n"
|
225
|
+
expected += "| Class | Covered | Required | Status |\n"
|
226
|
+
expected += "|:---|:---:|:---:|:---:|\n"
|
227
|
+
expected += "| `com/example/CachedRepository` | 50% | 40% | :white_check_mark: |\n"
|
228
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include(expected)
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'prints default failure subtitle' do
|
232
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
233
|
+
|
234
|
+
@my_plugin.minimum_project_coverage_percentage = 30
|
235
|
+
@my_plugin.minimum_class_coverage_percentage = 60
|
236
|
+
|
237
|
+
@my_plugin.report path_a
|
238
|
+
|
239
|
+
expected = "### JaCoCo Code Coverage 32.9% :white_check_mark:\n"
|
240
|
+
expected += "#### There are classes that do not meet coverage requirement :warning:\n"
|
241
|
+
expected += "| Class | Covered | Required | Status |\n"
|
242
|
+
expected += "|:---|:---:|:---:|:---:|\n"
|
243
|
+
expected += "| `com/example/CachedRepository` | 50% | 60% | :warning: |\n"
|
244
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include(expected)
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'prints custom success subtitle' do
|
248
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
249
|
+
|
250
|
+
@my_plugin.minimum_project_coverage_percentage = 30
|
251
|
+
@my_plugin.minimum_class_coverage_percentage = 40
|
252
|
+
@my_plugin.subtitle_success = 'You rock! 🔥'
|
253
|
+
|
254
|
+
@my_plugin.report path_a
|
255
|
+
|
256
|
+
expected = "### JaCoCo Code Coverage 32.9% :white_check_mark:\n"
|
257
|
+
expected += "#### You rock! 🔥\n"
|
258
|
+
expected += "| Class | Covered | Required | Status |\n"
|
259
|
+
expected += "|:---|:---:|:---:|:---:|\n"
|
260
|
+
expected += "| `com/example/CachedRepository` | 50% | 40% | :white_check_mark: |\n"
|
261
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include(expected)
|
262
|
+
end
|
263
|
+
|
264
|
+
it 'prints custom failure subtitle' do
|
265
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
266
|
+
|
267
|
+
@my_plugin.minimum_project_coverage_percentage = 30
|
268
|
+
@my_plugin.minimum_class_coverage_percentage = 60
|
269
|
+
@my_plugin.subtitle_failure = 'Too bad :('
|
270
|
+
|
271
|
+
@my_plugin.report path_a
|
272
|
+
|
273
|
+
expected = "### JaCoCo Code Coverage 32.9% :white_check_mark:\n"
|
274
|
+
expected += "#### Too bad :(\n"
|
275
|
+
expected += "| Class | Covered | Required | Status |\n"
|
276
|
+
expected += "|:---|:---:|:---:|:---:|\n"
|
277
|
+
expected += "| `com/example/CachedRepository` | 50% | 60% | :warning: |\n"
|
278
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include(expected)
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'prints default class column title' do
|
282
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
283
|
+
|
284
|
+
@my_plugin.report path_a
|
285
|
+
|
286
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'prints custom class column title' do
|
290
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
291
|
+
|
292
|
+
@my_plugin.class_column_title = 'New files'
|
293
|
+
|
294
|
+
@my_plugin.report path_a
|
295
|
+
|
296
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| New files | Covered | Required | Status |')
|
297
|
+
end
|
172
298
|
end
|
173
299
|
end
|
174
300
|
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.10
|
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-08-
|
12
|
+
date: 2022-08-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: danger-plugin-api
|
@@ -179,6 +179,11 @@ files:
|
|
179
179
|
- ".github/workflows/release.yaml"
|
180
180
|
- ".gitignore"
|
181
181
|
- ".rubocop.yml"
|
182
|
+
- ".yardoc/checksums"
|
183
|
+
- ".yardoc/complete"
|
184
|
+
- ".yardoc/object_types"
|
185
|
+
- ".yardoc/objects/root.dat"
|
186
|
+
- ".yardoc/proxy_types"
|
182
187
|
- Gemfile
|
183
188
|
- Guardfile
|
184
189
|
- LICENSE.txt
|
@@ -202,6 +207,7 @@ files:
|
|
202
207
|
- lib/jacoco/sax_parser.rb
|
203
208
|
- spec/fixtures/output_a.xml
|
204
209
|
- spec/fixtures/output_b.xml
|
210
|
+
- spec/fixtures/output_c.xml
|
205
211
|
- spec/jacoco_spec.rb
|
206
212
|
- spec/spec_helper.rb
|
207
213
|
homepage: https://github.com/alexanderbezverhni/danger-jacoco
|
@@ -230,5 +236,6 @@ summary: A longer description of danger-jacoco.
|
|
230
236
|
test_files:
|
231
237
|
- spec/fixtures/output_a.xml
|
232
238
|
- spec/fixtures/output_b.xml
|
239
|
+
- spec/fixtures/output_c.xml
|
233
240
|
- spec/jacoco_spec.rb
|
234
241
|
- spec/spec_helper.rb
|