Skip to content

Handle spec example name normalization #3490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented May 14, 2025

Motivation

We were not using the correct IDs for it examples in Minitest::Spec. Minitest will take the description and format it using the example count (see here).

This means that the Minitest reporter will use a different ID than discovery and we'll not be able to show results properly.

Implementation

Since we discover tests through static analysis, it is not possible to match the exact same numbers Minitest uses from the runtime for its examples.

Instead of trying to match that exactly, we can be more accurate if we use the line number of where we found that test as part of its ID - which is guaranteed to match. For this to work, we must ensure that both discovery and test result reporting are using the same ID formatting, which is what this PR does.

Note: there's a decision being made here, which is that dynamically defined anonymous tests cannot be supported (see the doc changes). They are not that common anyway and we have limited support for meta-programming.

Automated Tests

Added/improved current tests.

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 force-pushed the 05-13-handle_spec_example_name_normalization branch from fae872c to 2c3c28d Compare May 14, 2025 19:41
@vinistock vinistock self-assigned this May 14, 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 May 14, 2025 — with Graphite App
@vinistock vinistock marked this pull request as ready for review May 14, 2025 19:45
@vinistock vinistock requested a review from a team as a code owner May 14, 2025 19:45
@vinistock vinistock merged commit b8b425e into main May 15, 2025
39 of 45 checks passed
@vinistock vinistock deleted the 05-13-handle_spec_example_name_normalization branch May 15, 2025 12:42
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.

2 participants