minitest-mergify 2026.11.6 → 2026.11.7

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: 7eea6d83bada4b20a1534f8a89ecf567f30c0939c1a2ace4b6f9c8e86256edff
4
- data.tar.gz: 3fc1b13b238658a640cc62374fac69f3934b0ad7405d1a3ab61e478638a7573b
3
+ metadata.gz: 954d1f842aa88d2da7525893040f8dc0dc4f744a41392acf97c5b883cdb2e716
4
+ data.tar.gz: cc63837aa0ca9909db56881f0b6498ec75437aeae82fb9717809cdb99eb4c666
5
5
  SHA512:
6
- metadata.gz: cdab927ef9aba95031f39eee6f5e45a86a8b3438d4a891f81ae445e3ada4958eee8ee1faa5ddf60c286015a3f19757734f16cf012408c9edf27bbb8100c22106
7
- data.tar.gz: 84a5c634463691cd19c2a4f048654563e7b353bcb0885dbc33f1f56bb1c2ff7bd5edf66d99a5af43d17677da01bbcfa2e3d9feae3a43381f9056e24982f7cc39
6
+ metadata.gz: 8e98e4dc0486720fa07e4d5fe9a5fc519b5e85780c4c1dbd8600ce4627f94e491d5b32e9f14bea2a23c58c5950cf58b0740412e71f53bb6680c06b752c8321ef
7
+ data.tar.gz: cd519906762da51469a2011cf9a42a6bc670589b0730f26820b13688117e2d46b37abd13b2ec082e4d0cc91a03fffa014fa37b744675c4481e7c2101d4984ecf
data/README.md CHANGED
@@ -6,6 +6,7 @@ Minitest plugin for [Mergify Test Engine](https://docs.mergify.com/test-engine/)
6
6
 
7
7
  - **Test tracing** — Sends OpenTelemetry traces for every test to Mergify's API
8
8
  - **Test quarantine** — Quarantines failing tests so they don't block CI
9
+ - **Test skip** — Skips the tests a team chose in Mergify not to run, with the reason
9
10
  - **Test selection** — Runs first the tests that failed in a merge-queue bisection step, and stops once one fails again
10
11
  - **Flaky test detection** — Reruns new tests to catch flaky ones before they merge
11
12
  - **Test retry** — On the default branch, runs a failing test again, within a time budget Mergify sets
@@ -66,6 +67,10 @@ as a skip. A test quarantined while the repository uploaded JUnit reports is
66
67
  known under the name minitest-junit and minitest-reporters gave it,
67
68
  `UserTest.test_valid`, and is quarantined under that name too.
68
69
 
70
+ A test Mergify skips does not run: it skips itself before its `setup`, as
71
+ Minitest's `skip` does, with Mergify's reason, and is reported skipped. Its
72
+ teardown still runs, as for any skip.
73
+
69
74
  ### Fail First
70
75
 
71
76
  When Mergify's merge queue splits a batch that failed, the tests that failed
@@ -28,6 +28,18 @@ module Mergify
28
28
  end
29
29
  end
30
30
 
31
+ # A test the session skips skips itself, as Minitest's `skip` does,
32
+ # before its `setup` and its body run; its teardown still runs, as for
33
+ # any skip. Wherever it runs: inline, in Minitest's threads, in Rails'
34
+ # forked workers.
35
+ module Skipping
36
+ def before_setup
37
+ reason = Plugin.skip_reason(self)
38
+ skip(reason) if reason
39
+ super
40
+ end
41
+ end
42
+
31
43
  # The suites Minitest runs, once or in Fail First's two passes: the
32
44
  # loop is `run_all_suites` in Minitest 6, `__run` in Minitest 5.
33
45
  module Passes
@@ -61,34 +73,41 @@ module Mergify
61
73
  start(reporter, test_run, options)
62
74
  end
63
75
 
76
+ # Why the session skips `test`, a Minitest test about to run, or nil
77
+ # to run it: asked under its name and its former one.
78
+ def skip_reason(test)
79
+ file = test.class.instance_method(test.name).source_location&.first
80
+ return unless file
81
+
82
+ named = @names.of(test.class.name, test.name, file)
83
+ Mergify::Minitest.test_run.skip_reason([named.name, named.former])
84
+ end
85
+
64
86
  # The run's suites, as the selection runs them, once the session
65
87
  # prepared its reruns; then test retry's retries and flaky
66
- # detection's reruns -- not after a stop Fail First made, whose whole
67
- # point is to end the job sooner -- and last the failures test retry
68
- # held back for flaky detection's reruns.
88
+ # detection's reruns, which the session keeps from a run that
89
+ # stopped, and last the failures test retry held back for them.
69
90
  def run_suites(reporter, &)
70
91
  return yield unless @selection
71
92
 
72
93
  @reruns.prepare
73
94
  @selection.run(@recorder, &)
74
- unless @recorder.stopping?
75
- @retries.settle(@recorder, @selection.names_to_run)
76
- @reruns.run(reporter, @recorder)
77
- end
95
+ @retries.settle(@recorder, @selection.names_to_run)
96
+ @reruns.run(reporter, @recorder)
78
97
  @recorder.release_held(reporter)
79
98
  end
80
99
 
81
100
  private
82
101
 
83
102
  def start(reporter, test_run, options)
84
- names = Names.new(::Minitest::Runnable.runnables, Dir.pwd)
103
+ @names = Names.new(::Minitest::Runnable.runnables, Dir.pwd)
85
104
  # Collected as Minitest's filters leave the tests, before any
86
105
  # selection narrows them.
87
106
  @selection = nil
88
- @selection = select(test_run, names, options)
107
+ @selection = select(test_run, @names, options)
89
108
  @reruns = @selection && Reruns.new(test_run, @selection)
90
109
  @retries = @selection && Retries.new(test_run, @selection, @reruns)
91
- @recorder = Recorder.new(test_run, names, options[:io] || $stdout, @selection, @reruns, @retries)
110
+ @recorder = Recorder.new(test_run, @names, options[:io] || $stdout, @selection, @reruns, @retries)
92
111
  @recorder.attach(reporter)
93
112
  install
94
113
  end
@@ -108,6 +127,7 @@ module Mergify
108
127
  def install
109
128
  ::Minitest::Test.singleton_class.prepend(Narrowing) unless ::Minitest::Test.singleton_class < Narrowing
110
129
  ::Minitest.singleton_class.prepend(Passes) unless ::Minitest.singleton_class < Passes
130
+ ::Minitest::Test.prepend(Skipping) unless ::Minitest::Test < Skipping
111
131
  end
112
132
  end
113
133
  end
@@ -44,10 +44,13 @@ module Mergify
44
44
  @test_run.record_attempt(name, outcome, duration_ms)
45
45
  end
46
46
 
47
- # Rerun what flaky detection targets, once `recorder` recorded every test
48
- # the run was to run: a run in Minitest's threads or Rails' workers
49
- # hands its results back after its suites were handed over.
47
+ # Rerun what flaky detection targets, once the run's tests and every
48
+ # retry of them are over, as the session plans it, and once `recorder`
49
+ # recorded every test the run was to run: a run in Minitest's threads
50
+ # or Rails' workers hands its results back after its suites were
51
+ # handed over.
50
52
  def run(reporter, recorder)
53
+ @test_run.end_tests
51
54
  return unless @test_run.flaky_detection_runs?
52
55
 
53
56
  recorder.wait_for(@selection.names_to_run)
@@ -86,9 +86,10 @@ module Mergify
86
86
  put_first(fail_first) if fail_first
87
87
  end
88
88
 
89
- # The names of the tests the run is to run: every one it collected.
89
+ # The names of the tests the run is to run: every one it collected,
90
+ # or the ones it put first once Fail First kept the rest from starting.
90
91
  def names_to_run
91
- @tests.to_set(&:name)
92
+ @stopped ? @first_names : @tests.to_set(&:name)
92
93
  end
93
94
 
94
95
  # The tests of `klass`, of `methods`, that run now.
@@ -111,7 +112,8 @@ module Mergify
111
112
  # They may run in Minitest's threads or Rails' workers: their results
112
113
  # come back after the suites were handed over.
113
114
  recorder.wait_for(@first_names)
114
- return if recorder.stopping?
115
+ @stopped = recorder.stopping?
116
+ return if @stopped
115
117
 
116
118
  @pass = :rest
117
119
  run_suites.call
@@ -40,8 +40,9 @@ module Mergify
40
40
  VERSION, output, doubles, enabled?, client: 'minitest-mergify', **FRAMEWORK
41
41
  )
42
42
  # What a run that reports loads before its tests: the quarantine list
43
- # for the branch they target. Without one (no branch, a failed fetch,
44
- # no token) nothing is quarantined, and its block says why.
43
+ # for the branch they target, and the tests it skips. Without one (no
44
+ # branch, a failed fetch, no token) nothing is quarantined or skipped,
45
+ # and its block says why.
45
46
  @quarantine = @session.load_before_tests if reports?
46
47
  end
47
48
 
@@ -88,6 +89,13 @@ module Mergify
88
89
  @session.report_verdict(false)
89
90
  end
90
91
 
92
+ # The run's tests are over, and every retry of them. Fail First's is
93
+ # the only stop that gets here, and the session knows of it: an
94
+ # interrupt raises past this.
95
+ def end_tests
96
+ @session.end_tests(false)
97
+ end
98
+
91
99
  # Whether flaky detection runs in this run: Mergify answered, and the
92
100
  # repository opted in.
93
101
  def flaky_detection_runs?
@@ -131,6 +139,12 @@ module Mergify
131
139
  @quarantine.record(names, outcome)
132
140
  end
133
141
 
142
+ # Why the session says not to run the test known by `names`, or nil to
143
+ # run it.
144
+ def skip_reason(names)
145
+ @quarantine&.skip_reason(names)
146
+ end
147
+
134
148
  # Hand the session a test once it finished (see
135
149
  # `Mergify::CI::Core::Native::Session#record_case`): its span joins the
136
150
  # run's trace.
@@ -4,6 +4,6 @@ module Mergify
4
4
  module Minitest
5
5
  # Placeholder: the release workflow stamps the real version from the git
6
6
  # tag at build time, as it does for every client in this repository.
7
- VERSION = '2026.11.6'
7
+ VERSION = '2026.11.7'
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-mergify
3
3
  version: !ruby/object:Gem::Version
4
- version: 2026.11.6
4
+ version: 2026.11.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mergify
@@ -35,14 +35,14 @@ dependencies:
35
35
  requirements:
36
36
  - - '='
37
37
  - !ruby/object:Gem::Version
38
- version: 2026.11.6
38
+ version: 2026.11.7
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
42
42
  requirements:
43
43
  - - '='
44
44
  - !ruby/object:Gem::Version
45
- version: 2026.11.6
45
+ version: 2026.11.7
46
46
  description: 'Minitest integration for Mergify Test Engine: the run reported to CI
47
47
  Insights, test quarantine, Fail First on merge-queue bisection steps, and flaky
48
48
  test detection.'