Skip to content

Conversation

@vinistock
Copy link
Member

@vinistock vinistock commented Aug 15, 2025

Motivation

Closes #3712

When we find no test classes, we were considering the describe groups to start at index 1 in our stack of test groups. If you have a module wrapping those specs, that won't be true as there will be a corresponding nil entry in the stack (which we use to balance the stack).

We need to search for what is actually the first index to account for this possibility.

Implementation

Started searching for what is the first spec group, rather than assuming that it's always the first one. I also moved our in_spec_context? check since we want to allow the describe to be discovered even if the nesting is not empty and we haven't yet found a spec group (which is what happens when there's only a top level module).

Automated Tests

Added a test that reproduces the scenario.

Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock self-assigned this Aug 15, 2025
@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Aug 15, 2025 — with Graphite App
@vinistock vinistock marked this pull request as ready for review August 15, 2025 21:04
@vinistock vinistock requested a review from a team as a code owner August 15, 2025 21:04
@graphite-app
Copy link

graphite-app bot commented Aug 15, 2025

Merge activity

### Motivation

Closes #3712

When we find no test classes, we were considering the describe groups to start at index 1 in our stack of test groups. If you have a module wrapping those specs, that won't be true as there will be a corresponding `nil` entry in the stack (which we use to balance the stack).

We need to search for what is actually the first index to account for this possibility.

### Implementation

Started searching for what is the first spec group, rather than assuming that it's always the first one. I also moved our `in_spec_context?` check since we want to allow the `describe` to be discovered even if the nesting is not empty and we haven't yet found a spec group (which is what happens when there's only a top level module).

### Automated Tests

Added a test that reproduces the scenario.
@graphite-app graphite-app bot force-pushed the 08-15-account_for_module_wrapping_minitest_specs branch from 0d135ae to 514a20e Compare August 15, 2025 22:01
@graphite-app graphite-app bot merged commit 514a20e into main Aug 15, 2025
36 checks passed
@graphite-app graphite-app bot deleted the 08-15-account_for_module_wrapping_minitest_specs branch August 15, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests defined within a module are not discovered

2 participants