rspec_trunk_flaky_tests 0.7.6-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: 411ab97e396ec32215dee0e26eaebc7f3cf05ea8621181dc32c55937642f1299
4
- data.tar.gz: e4a150183c3ef7a29d5b5ec5ce26f5e1b00ba30b4af319b5d70d5efae19f766e
3
+ metadata.gz: 3ec9945d70a974463369f172401ecbb0d17d66d1a15643d81a905f358f58161c
4
+ data.tar.gz: f3e89173beaa624cdbd1610a8e6dcc1adf6874fbf6dc1dd2af0b6411643b3901
5
5
  SHA512:
6
- metadata.gz: b4ca4d3fb03ea9b58ea2a0c82ce9a43d0b7479baaa5d57f1b84b597699a9a84d23f42edb63fbe68e7f3410b90677be2ac9e6a8d67c64b8b5e3b66342e1d421a2
7
- data.tar.gz: d09aa9e09e1e573ab3c196d3ecbacfeacef60cdfe1134419b35e971751b9cf9566ecb813afd3674b91bce540a1fd14cb650068e49113db57c40b6f36152e02a9
6
+ metadata.gz: 9c737d736671caa87968e5d5c317fc3fffd9cf90a69d9778d4c05653556821b66f1e02e061b5805570db5122562afe7b888da46465562b13c3969dae29eb7e47
7
+ data.tar.gz: 83414eae2be8f66884787675092182a7958fc37cf9718d0e7099ae3f295991221c88c48ef576d84877912def729c5add7180e5363f95a101b4f32e233c357c9b
@@ -28,18 +28,6 @@ def escape(str)
28
28
  str.dump[1..-2]
29
29
  end
30
30
 
31
- def description_generated?(example)
32
- auto_generated_exp = /^\s?is expected to .*$/
33
- full_description = example.full_description
34
- parent_description = example.example_group.description
35
- checked_description = full_description.sub(parent_description, '')
36
- !auto_generated_exp.match(checked_description).nil? || full_description.empty?
37
- end
38
-
39
- def generate_id(example)
40
- return "trunk:#{example.id}-#{example.location}" if description_generated?(example)
41
- end
42
-
43
31
  def trunk_disabled
44
32
  ENV['DISABLE_RSPEC_TRUNK_FLAKY_TESTS'] == 'true' || ENV['TRUNK_ORG_URL_SLUG'].nil? || ENV['TRUNK_API_TOKEN'].nil?
45
33
  end
@@ -53,6 +41,7 @@ module RSpec
53
41
  class Example
54
42
  # keep the original method around so we can call it
55
43
  alias set_exception_core set_exception
44
+ alias assign_generated_description_core assign_generated_description
56
45
  # RSpec uses the existance of an exception to determine if the test failed
57
46
  # We need to override this to allow us to capture the exception and then
58
47
  # decide if we want to fail the test or not
@@ -60,7 +49,7 @@ module RSpec
60
49
  def set_exception(exception)
61
50
  return set_exception_core(exception) if trunk_disabled
62
51
 
63
- id = generate_id(self)
52
+ id = generate_trunk_id
64
53
  name = full_description
65
54
  parent_name = example_group.metadata[:description]
66
55
  parent_name = parent_name.empty? ? 'rspec' : parent_name
@@ -78,6 +67,21 @@ module RSpec
78
67
  end
79
68
  end
80
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
+
81
85
  # Procsy is a class that is used to wrap execution of the Example class
82
86
  class Procsy
83
87
  def run_with_trunk
@@ -134,8 +138,7 @@ class TrunkAnalyticsListener
134
138
  end
135
139
 
136
140
  def close(_notification)
137
- res = @testreport.publish
138
- if res
141
+ if @testreport.publish
139
142
  puts 'Flaky tests report upload complete'.green
140
143
  else
141
144
  puts 'Failed to publish flaky tests report'.red
@@ -153,7 +156,7 @@ class TrunkAnalyticsListener
153
156
  line = example.metadata[:line_number]
154
157
  started_at = example.execution_result.started_at.to_i
155
158
  finished_at = example.execution_result.finished_at.to_i
156
- id = generate_id(example)
159
+ id = example.generate_trunk_id
157
160
 
158
161
  attempt_number = example.metadata[:attempt_number] || 0
159
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.6
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-04-02 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