Skip to content

Allow running tests without a bundle #3689

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Jul 25, 2025

Motivation

Closes #3561

It's not uncommon for Rubyists to have unit tests for some scripts that do not have any dependencies (no bundle). There were two issues preventing us from running tests:

  1. Because there's no bundle, we never index the parent class (e.g.: Minitest::Test) and so the linearized ancestors the class only end up including itself
  2. We were using an incorrect Bundler helper to determine the base command

Implementation

For 1, I started checking if there's only the class itself in the list of ancestors, which indicates that we're hitting this scenario. In that case, I started including the parent class if available, which allows us to discover tests.

Note that there's one limitation: if the user introduces an intermediate parent class, we won't be able to discover the tests.

For 2, the method we should've been using is with_unbundled_env, which removes Bundler related variables and allows us to discover if there's a main bundle in the project.

Automated Tests

Added a test that reproduces.

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 Jul 25, 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 Jul 25, 2025 — with Graphite App
@vinistock vinistock marked this pull request as ready for review July 25, 2025 16:07
@vinistock vinistock requested a review from a team as a code owner July 25, 2025 16:07
@vinistock vinistock force-pushed the 07-25-allow_running_tests_without_a_bundle branch from 1d58640 to 4e7bc71 Compare July 25, 2025 18:02
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.

Allow running tests without a bundle
1 participant