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

Line numbers do not work if multiple tests have the same "it" description #90

Open
rosatolen opened this issue Apr 8, 2022 · 3 comments

Comments

@rosatolen
Copy link

Given the below tests, when I run m /spec.rb:8, I expect the m runner to only execute the test in scenario2. But instead, it executes both scenario1 and scenario2 because the two "it" sections have the same description.

1   describe 'scenario1' do
2      it 'is a good test' do
3        ...
4      end
5   end
6
7   describe 'scenario2' do
8      it 'is a good test' do
9        ...
10     end
11  end
@zamith
Copy link
Collaborator

zamith commented Jun 1, 2022

Which testing library are you using?

@gi
Copy link
Collaborator

gi commented Jul 19, 2022

@rosatolen One current work around is to use the passthrough feature to send the name parameter to the underlying runner:

bundle exec m spec.rb -- --name '/scenario1.*good test/'

@rosatolen
Copy link
Author

It's minitest underneath.

@gi Yeah I wanted functionality more like rspec's line number test selection. Rspec tests are a lot easier to run than minitest in my vim test runner because it's easy for vim to reference the line number instead of trying to parse the "it" description string.

I was hoping m would help me get minitest working automagically with my vim test runner since it enables line number selection. m does help get things going but I found this error with two matching "it" clauses in different describe sections. It doesn't seem like m is meant to run both tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants