m icon indicating copy to clipboard operation
m copied to clipboard

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

Open rosatolen opened this issue 2 years ago • 3 comments

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

rosatolen avatar Apr 08 '22 20:04 rosatolen

Which testing library are you using?

zamith avatar Jun 01 '22 15:06 zamith

@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/'

gi avatar Jul 19 '22 07:07 gi

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.

rosatolen avatar Jul 23 '22 19:07 rosatolen