blinka-reporter 0.3.6 → 0.5.2

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: 06c9c5c7a1de551d63e7b5c847e8f63141b3947b2e2438bb99682df7533dbf65
4
- data.tar.gz: 04efe62851c48eb4b956f9ab749a3c9910edaa13fdb910e3e21ab1b8687815ce
3
+ metadata.gz: 7e989cf76be03d9a1010a66f3f76a0b00926a5b294bc07ce532266fed4bd1b0c
4
+ data.tar.gz: fa30a9180feada7dd619e2e0040bce323114c06655f6c99ed20764fc5fe89538
5
5
  SHA512:
6
- metadata.gz: f2f18d7a70bec74bfa5df5777f3a31b0b87ec7d957d74a1571e1f6ee25c2e71b897f4ce89314c808579ae3448e28c98263dfe3cdbe03d262a6223d6a821a0c90
7
- data.tar.gz: 9212e1935d61b03e366407c0a964fa5726c2d523031a61066f8b19233c9f1da23f38de3b21d5ade2e123f60498402dae054a16c8416856c6f338d81e07c5a725
6
+ metadata.gz: 31256af730acd4d5521dc3f978df9b379698d0b254eb0cb1df12bdcc885bddb01a98694b9c454b78e9e51d9bca32574e53b07a7563444a08ec5494e1e633a770
7
+ data.tar.gz: aa9408c278883df6c8958f1a3332d44f666fd5fc0cbcd9c1b246b64f1a6134886947e4b1da68e27c5873b99e5627c0f561c0c6bb2e591aff96652b7d1a4a9bfe
@@ -44,7 +44,7 @@ class BlinkaMinitest
44
44
  elsif @test_result.skipped?
45
45
  :skip
46
46
  elsif @test_result.failure
47
- :failed
47
+ :fail
48
48
  else
49
49
  :pass
50
50
  end
@@ -61,7 +61,14 @@ class BlinkaMinitest
61
61
  def image
62
62
  return unless kind == 'system'
63
63
 
64
- image_path = "./tmp/screenshots/failures_#{name}.png"
64
+ image_path =
65
+ if defined?(Capybara) && Capybara.respond_to?(:save_path) &&
66
+ Capybara.save_path.present?
67
+ "#{Capybara.save_path}/failures_#{name}.png"
68
+ else
69
+ "./tmp/screenshots/failures_#{name}.png"
70
+ end
71
+
65
72
  return unless File.exist?(image_path)
66
73
 
67
74
  image_path
@@ -1,3 +1,3 @@
1
1
  module BlinkaReporter
2
- VERSION = '0.3.6'.freeze
2
+ VERSION = '0.5.2'.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blinka-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.5.2
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-25 00:00:00.000000000 Z
11
+ date: 2022-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.18.1
19
+ version: '0.18'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.18.1
26
+ version: '0.18'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dotenv
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -113,6 +113,7 @@ metadata:
113
113
  documentation_uri: https://github.com/davidwessman/blinka_reporter
114
114
  changelog_uri: https://github.com/davidwessman/blinka_reporter/main/CHANGELOG.md
115
115
  source_code_uri: https://github.com/davidwessman/blinka_reporter
116
+ rubygems_mfa_required: 'true'
116
117
  post_install_message:
117
118
  rdoc_options: []
118
119
  require_paths: