rspec_trunk_flaky_tests 0.7.5-x86_64-darwin → 0.7.7-x86_64-darwin

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86574eb1db68bf0f06f4b2e03c072b746a74e2da8cfe324af79ec3e6adc3bd67
4
- data.tar.gz: 7e15460fbd3f2ec674df1b646f1ae751bfb86048819ab11f29c9b38d7bdbfdca
3
+ metadata.gz: 3ec9945d70a974463369f172401ecbb0d17d66d1a15643d81a905f358f58161c
4
+ data.tar.gz: f3e89173beaa624cdbd1610a8e6dcc1adf6874fbf6dc1dd2af0b6411643b3901
5
5
  SHA512:
6
- metadata.gz: 451200763b498f417460f84bcc9daf80e8b69f6c996e2b59abc0b1bdcebba780cd395ef19b3966b4092e08cf17c8268ec3ee37d0ff0e04101b558285fb55dc24
7
- data.tar.gz: 887b4af52a1814332fd9f2d99771d5d66a2d8ee04dce1898deac9d7fe2896827948b38c6344cd44f8655c41d80c6bb88d21180c20ca4be75c00e8aa5552bc6de
6
+ metadata.gz: 9c737d736671caa87968e5d5c317fc3fffd9cf90a69d9778d4c05653556821b66f1e02e061b5805570db5122562afe7b888da46465562b13c3969dae29eb7e47
7
+ data.tar.gz: 83414eae2be8f66884787675092182a7958fc37cf9718d0e7099ae3f295991221c88c48ef576d84877912def729c5add7180e5363f95a101b4f32e233c357c9b
@@ -4,6 +4,8 @@ require 'rspec/core'
4
4
  require 'time'
5
5
  require 'context_ruby'
6
6
 
7
+ # String is an override to the main String class that is used to colorize the output
8
+ # it is used to make the output more readable
7
9
  class String
8
10
  def colorize(color_code)
9
11
  "\e[#{color_code}m#{self}\e[0m"
@@ -26,18 +28,6 @@ def escape(str)
26
28
  str.dump[1..-2]
27
29
  end
28
30
 
29
- def description_generated?(example)
30
- auto_generated_exp = /^\s?is expected to eq .*$/
31
- full_description = example.full_description
32
- parent_description = example.example_group.description
33
- checked_description = full_description.sub(parent_description, '')
34
- !auto_generated_exp.match(checked_description).nil? || full_description.empty?
35
- end
36
-
37
- def generate_id(example)
38
- return "trunk:#{example.id}-#{example.location}" if description_generated?(example)
39
- end
40
-
41
31
  def trunk_disabled
42
32
  ENV['DISABLE_RSPEC_TRUNK_FLAKY_TESTS'] == 'true' || ENV['TRUNK_ORG_URL_SLUG'].nil? || ENV['TRUNK_API_TOKEN'].nil?
43
33
  end
@@ -51,6 +41,7 @@ module RSpec
51
41
  class Example
52
42
  # keep the original method around so we can call it
53
43
  alias set_exception_core set_exception
44
+ alias assign_generated_description_core assign_generated_description
54
45
  # RSpec uses the existance of an exception to determine if the test failed
55
46
  # We need to override this to allow us to capture the exception and then
56
47
  # decide if we want to fail the test or not
@@ -58,7 +49,7 @@ module RSpec
58
49
  def set_exception(exception)
59
50
  return set_exception_core(exception) if trunk_disabled
60
51
 
61
- id = generate_id(self)
52
+ id = generate_trunk_id
62
53
  name = full_description
63
54
  parent_name = example_group.metadata[:description]
64
55
  parent_name = parent_name.empty? ? 'rspec' : parent_name
@@ -76,6 +67,21 @@ module RSpec
76
67
  end
77
68
  end
78
69
 
70
+ def assign_generated_description
71
+ metadata[:is_description_generated] = description_generated?
72
+ assign_generated_description_core
73
+ end
74
+
75
+ def description_generated?
76
+ return metadata[:is_description_generated] unless metadata[:is_description_generated].nil?
77
+
78
+ description == location_description
79
+ end
80
+
81
+ def generate_trunk_id
82
+ return "trunk:#{id}-#{location}" if description_generated?
83
+ end
84
+
79
85
  # Procsy is a class that is used to wrap execution of the Example class
80
86
  class Procsy
81
87
  def run_with_trunk
@@ -132,8 +138,7 @@ class TrunkAnalyticsListener
132
138
  end
133
139
 
134
140
  def close(_notification)
135
- res = @testreport.publish
136
- if res
141
+ if @testreport.publish
137
142
  puts 'Flaky tests report upload complete'.green
138
143
  else
139
144
  puts 'Failed to publish flaky tests report'.red
@@ -151,7 +156,7 @@ class TrunkAnalyticsListener
151
156
  line = example.metadata[:line_number]
152
157
  started_at = example.execution_result.started_at.to_i
153
158
  finished_at = example.execution_result.finished_at.to_i
154
- id = generate_id(example)
159
+ id = example.generate_trunk_id
155
160
 
156
161
  attempt_number = example.metadata[:attempt_number] || 0
157
162
  status = example.execution_result.status.to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_trunk_flaky_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.7
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - Trunk Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-27 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core