blinka-reporter 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blinka_reporter/version.rb +1 -1
- data/lib/minitest/blinka_plugin.rb +29 -4
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53d0803a1ef9055ba4f96126c073557f1c609fa7744cfeaecf05434bc43bc49a
|
4
|
+
data.tar.gz: b6474ced0df1e5021351f4e1cede83eb4102450750b832845d63d49d534b018d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e158fe5fc61ed571aaea0d0ebd45050731c41db9b148db1e3524ad54e3d345f430892109039228bc338d79d0a79d98ecbfc9bd7e5420c341eebabfa7abd3458b
|
7
|
+
data.tar.gz: e0210373323a0b51bf37d01ddbe7ddf7fdef61c966884296ef52d5ad79faf5f832900b5357276365291e76f72db844c0045e6984fc728089aeea769cf2b5c01f
|
@@ -11,6 +11,7 @@ module Minitest
|
|
11
11
|
def plugin_blinka_options(opts, options); end
|
12
12
|
|
13
13
|
module BlinkaPlugin
|
14
|
+
REPORT_PATH = 'blinka_results.json'.freeze
|
14
15
|
TAP_COMMENT_PAD = 8
|
15
16
|
class Reporter < Minitest::StatisticsReporter
|
16
17
|
attr_accessor :tests
|
@@ -29,7 +30,9 @@ module Minitest
|
|
29
30
|
super
|
30
31
|
|
31
32
|
tap_report if ENV['BLINKA_TAP']
|
32
|
-
|
33
|
+
if ENV['BLINKA_JSON'] || ENV['BLINKA_REPORT']
|
34
|
+
json_report(append: !ENV['BLINKA_APPEND'].nil?)
|
35
|
+
end
|
33
36
|
BlinkaClient.new.report if ENV['BLINKA_REPORT']
|
34
37
|
rescue BlinkaClient::BlinkaError => error
|
35
38
|
puts(error)
|
@@ -37,7 +40,7 @@ module Minitest
|
|
37
40
|
|
38
41
|
private
|
39
42
|
|
40
|
-
def json_report
|
43
|
+
def json_report(append:)
|
41
44
|
result = {
|
42
45
|
total_time: total_time,
|
43
46
|
nbr_tests: count,
|
@@ -48,12 +51,14 @@ module Minitest
|
|
48
51
|
results:
|
49
52
|
tests.map { |test_result| BlinkaMinitest.new(test_result).report }
|
50
53
|
}
|
54
|
+
result = append_previous(result) if append
|
51
55
|
|
52
|
-
File.open(
|
56
|
+
File.open(REPORT_PATH, 'w+') do |file|
|
53
57
|
file.write(JSON.pretty_generate(result))
|
54
58
|
end
|
59
|
+
|
55
60
|
puts
|
56
|
-
puts(
|
61
|
+
puts("Test results written to `#{REPORT_PATH}`")
|
57
62
|
end
|
58
63
|
|
59
64
|
# Based on https://github.com/kern/minitest-reporters/blob/master/lib/minitest/reporters/progress_reporter.rb
|
@@ -95,6 +100,26 @@ module Minitest
|
|
95
100
|
)
|
96
101
|
)
|
97
102
|
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def parse_report
|
107
|
+
return unless File.exist?(REPORT_PATH)
|
108
|
+
JSON.parse(File.read(REPORT_PATH))
|
109
|
+
end
|
110
|
+
|
111
|
+
def append_previous(result)
|
112
|
+
previous = parse_report
|
113
|
+
return if previous.nil?
|
114
|
+
return if result[:commit] != previous['commit']
|
115
|
+
return if result[:tag] != previous['tag']
|
116
|
+
|
117
|
+
result[:total_time] += previous['total_time'] || 0
|
118
|
+
result[:nbr_tests] += previous['nbr_tests'] || 0
|
119
|
+
result[:nbr_assertions] += previous['nbr_assertions'] || 0
|
120
|
+
result[:results] += previous['results'] || []
|
121
|
+
result
|
122
|
+
end
|
98
123
|
end
|
99
124
|
end
|
100
125
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blinka-reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Wessman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.18.1
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.21.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 0.18.1
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.21.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: dotenv
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|