rspec-mergify 0.0.8 → 0.1.1

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: b2aa62d95ba898d757936c94d09afcd0d2159431ecec165322c55bf2587a3cdc
4
- data.tar.gz: fd0d8d9b9b0546f6c57c5452071633e74c05699aa04d99a27fc94be33be055a7
3
+ metadata.gz: a69562ff8faf56e93122d4a11c50cf94e4d328a06a57b84cbc7eff1a80dc3dc9
4
+ data.tar.gz: d5cdd6a938db90e73a0771a2646b0aa9f303c120ffd72e26df8c02df3a19cbbe
5
5
  SHA512:
6
- metadata.gz: 13a96cbd8cca285d5b63135663ee3704e6ba376fc6b10b124b9154ee398810eab1ce78712f01579e8eb28e0a90d17ed2766dc4e5694099ad98b32cc2d135ba12
7
- data.tar.gz: 88d6b19106bffab709aa494ddabab89c959c5fc28397f2c01d220f8cbded9882b450fccbb8f48f238e79a14a935a05a18b496f9f8e98bc1fbd89edad66b61ad6
6
+ metadata.gz: 4d6f8fdc77e89ecb4a69c3c44804b2b75ee6749cd4f0f664e903629a6216e4c1be7860a0a774df2b1c90e6eee233f18a5d1e9d07b94949b5c106972f7849cb30
7
+ data.tar.gz: 2228d6143a76bfba2f0e955ee6ca988d89786e0aeedb9ed2a00d2dde40678dff529f4dd276a30fc7b31f77290389da1b09e40f467021203f578fa760b84c5ee8
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # rspec-mergify
2
2
 
3
- RSpec plugin for [Mergify CI Insights](https://docs.mergify.com/ci-insights/).
3
+ RSpec plugin for [Mergify Test Insights](https://docs.mergify.com/ci-insights/).
4
4
 
5
5
  ## Features
6
6
 
@@ -35,6 +35,8 @@ The plugin activates automatically when running in CI (detected via the `CI` env
35
35
  | `MERGIFY_TRACEPARENT` | W3C distributed trace context | — |
36
36
  | `MERGIFY_TEST_JOB_NAME` | Mergify test job name | — |
37
37
 
38
+ For detailed documentation, see the [official guide](https://docs.mergify.com/ci-insights/test-frameworks/rspec/).
39
+
38
40
  ## Development
39
41
 
40
42
  ### Prerequisites
@@ -13,7 +13,7 @@ require_relative 'resources/rspec'
13
13
 
14
14
  module Mergify
15
15
  module RSpec
16
- # Central orchestrator for CI Insights: sets up OpenTelemetry tracing,
16
+ # Central orchestrator for Mergify Test Insights: sets up OpenTelemetry tracing,
17
17
  # manages the tracer provider, and coordinates flaky detection and quarantine.
18
18
  # rubocop:disable Metrics/ClassLength
19
19
  class CIInsights
@@ -5,7 +5,7 @@ require 'set'
5
5
  module Mergify
6
6
  module RSpec
7
7
  # Registers RSpec hooks for quarantine and flaky detection, and adds the
8
- # CI Insights formatter when running inside CI.
8
+ # Mergify Test Insights formatter when running inside CI.
9
9
  module Configuration
10
10
  module_function
11
11
 
@@ -64,6 +64,10 @@ module Mergify
64
64
  distinct_outcomes.add(example.execution_result.status) if example.execution_result.status
65
65
 
66
66
  rerun_count = 0
67
+ # Use a null reporter to prevent reruns from being reported as
68
+ # individual failures. The final outcome is set after the loop.
69
+ null_reporter = ::RSpec::Core::NullReporter
70
+
67
71
  until example.metadata[:is_last_rerun]
68
72
  example.metadata[:is_last_rerun] = fd.last_rerun_for_test?(example.id)
69
73
 
@@ -80,7 +84,7 @@ module Mergify
80
84
  end
81
85
  end
82
86
 
83
- example.run
87
+ example.run(example.example_group_instance, null_reporter)
84
88
 
85
89
  # Feed rerun metrics so budget/deadline tracking stays accurate
86
90
  rerun_time = example.execution_result.run_time || 0.0
@@ -103,7 +107,7 @@ module Mergify
103
107
 
104
108
  example.instance_variable_set(:@exception, nil)
105
109
  example.execution_result.status = :pending
106
- example.execution_result.pending_message = 'Test is quarantined from Mergify CI Insights'
110
+ example.execution_result.pending_message = 'Test is quarantined from Mergify Test Insights'
107
111
  end
108
112
  end
109
113
  end
@@ -5,7 +5,7 @@ require 'opentelemetry-sdk'
5
5
 
6
6
  module Mergify
7
7
  module RSpec
8
- # RSpec formatter that creates OpenTelemetry spans for CI Insights and
8
+ # RSpec formatter that creates OpenTelemetry spans for Mergify Test Insights and
9
9
  # prints a terminal report. It is purely observational and does not modify
10
10
  # test execution.
11
11
  # rubocop:disable Metrics/ClassLength
@@ -134,6 +134,7 @@ module Mergify
134
134
  def set_error_attributes(span, exception)
135
135
  span.set_attribute('exception.type', exception.class.to_s)
136
136
  span.set_attribute('exception.message', exception.message)
137
+ span.set_attribute('exception.stacktrace', exception.backtrace&.join("\n") || '')
137
138
  span.status = OpenTelemetry::Trace::Status.error(exception.message)
138
139
  end
139
140
 
@@ -154,7 +155,7 @@ module Mergify
154
155
  output.puts '--- Mergify CI ---'
155
156
 
156
157
  unless @ci_insights
157
- output.puts 'Mergify CI Insights is not configured.'
158
+ output.puts 'Mergify Test Insights is not configured.'
158
159
  return
159
160
  end
160
161
 
@@ -210,7 +211,7 @@ module Mergify
210
211
  output.puts ''
211
212
  output.puts 'Common issues:'
212
213
  output.puts ' - Your MERGIFY_TOKEN might not be set or could be invalid'
213
- output.puts ' - CI Insights might not be enabled for this repository'
214
+ output.puts ' - Mergify Test Insights might not be enabled for this repository'
214
215
  output.puts ' - There might be a network connectivity issue with the Mergify API'
215
216
  output.puts ''
216
217
  output.puts 'Documentation: https://docs.mergify.com/ci-insights/test-frameworks/'
@@ -101,12 +101,7 @@ module Mergify
101
101
  # Attributes whose env var is unset or whose callable returns nil are omitted.
102
102
  def get_attributes(mapping)
103
103
  mapping.each_with_object({}) do |(attr, (cast, env_or_callable)), result|
104
- value =
105
- if env_or_callable.respond_to?(:call)
106
- env_or_callable.call
107
- else
108
- ENV.fetch(env_or_callable, nil)
109
- end
104
+ value = env_or_callable.respond_to?(:call) ? env_or_callable.call : ENV.fetch(env_or_callable, nil)
110
105
 
111
106
  next if value.nil?
112
107
  next if value.respond_to?(:empty?) && value.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-mergify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mergify