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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad98fd45f2147f5fd55ca1d55c6f672feacbe41ac3b76b192ac6080992901107
4
- data.tar.gz: 36abc057b50457b372f1edea9d1e6fadb3088ccf6e9f21db2da2be10d804bfb4
3
+ metadata.gz: 53d0803a1ef9055ba4f96126c073557f1c609fa7744cfeaecf05434bc43bc49a
4
+ data.tar.gz: b6474ced0df1e5021351f4e1cede83eb4102450750b832845d63d49d534b018d
5
5
  SHA512:
6
- metadata.gz: 65e2258b6777627483a15f3b1b1d3a8abf3ad5b8f0d88b71f1b32c9745d22cbc6da165864074e00338bb0479c352305ca8841cc242936c4b1bd7a6cc42e43af8
7
- data.tar.gz: a5bd248c55c5a164970326fe24a8277ea6b869ad9fab6f9fecab786166c9dc5e982521f2fea5ba9c18408a7023ff3cc39a41af83c67f56996205713e6fc567bf
6
+ metadata.gz: e158fe5fc61ed571aaea0d0ebd45050731c41db9b148db1e3524ad54e3d345f430892109039228bc338d79d0a79d98ecbfc9bd7e5420c341eebabfa7abd3458b
7
+ data.tar.gz: e0210373323a0b51bf37d01ddbe7ddf7fdef61c966884296ef52d5ad79faf5f832900b5357276365291e76f72db844c0045e6984fc728089aeea769cf2b5c01f
@@ -1,3 +1,3 @@
1
1
  module BlinkaReporter
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
@@ -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
- json_report if ENV['BLINKA_JSON'] || ENV['BLINKA_REPORT']
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('blinka_results.json', 'w+') do |file|
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('Test results written to `./blinka_results.json`')
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.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: 2021-03-27 00:00:00.000000000 Z
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