qrush / m

A Test::Unit runner that can run tests by line number.
MIT License
375 stars 59 forks source link

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

Open rosatolen opened 2 years ago

rosatolen commented 2 years ago

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 commented 2 years ago

Which testing library are you using?

gi commented 2 years ago

@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 commented 2 years ago

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.