Skip to content
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

Use ancestors to determine test framework in code lens #1334

Open
vinistock opened this issue Jan 29, 2024 · 7 comments
Open

Use ancestors to determine test framework in code lens #1334

vinistock opened this issue Jan 29, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale

Comments

@vinistock
Copy link
Member

vinistock commented Jan 29, 2024

Depends on #1333 (complete)

We currently try to determine the test framework based on dependencies. This is an okay approach, but once we have ancestors available we can be a lot more accurate.

We can check if a test inherits from Minitest::Test or Test::Unit::TestCase and then decide based on that - ideally with a fallback if we can't determine the framework for whatever reason.

@vinistock vinistock added the enhancement New feature or request label Jan 29, 2024
@andyw8
Copy link
Contributor

andyw8 commented Jan 29, 2024

That would be great.

Copy link
Contributor

This issue is being marked as stale because there was no activity in the last 2 months

@github-actions github-actions bot added the Stale label Mar 30, 2024
@vinistock vinistock added pinned This issue or pull request is pinned and won't be marked as stale and removed Stale labels Apr 1, 2024
@amomchilov
Copy link

As a note, when we implement this, we should look for extend ActiveSupport::Testing::Declarative instead of < ActiveSupport::TestCase.

That would let us support users who want to support the declarative syntax of AS::TC, who don't wish to use the whole thing.

@jmarsh24
Copy link

+1 This would be a great feature!

@ricksuggs
Copy link

ricksuggs commented Jan 8, 2025

+1 - I use rspec-mocks in a project, but use Minitest as the test runner and Ruby LSP is detecting the test framework as rspec because it's only checking for the string rspec in any of the dependencies. The code lenses are not showing up in the Minitest tests, or in the Test Explorer.

Can an option be added to explicitly override the test framework?

@vinistock
Copy link
Member Author

Can an option be added to explicitly override the test framework?

I would rather just implement the correct solution straight away. I'd avoid adding more configuration for something we can properly detect automatically.

Also, there are other corner cases that wouldn't be covered, like someone who reported using both RSpec and Minitest in the same application.

@nhumble-sa
Copy link
Contributor

While I understand not wanting to add an additional configuration option, doing so solves many of the use-cases quickly and the auto mode can be incrementally improved until it won't be as necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants