Open D-system opened 5 months ago
Normally the 2 should use the same command to run tests, which theoretically should have similar duration. Can you provide more information? Like the actual commands being invoked?
One possibility is that the one runs in terminal utilizes spring, while the one runs in test explorer doesn’t.
It runs each tests individually. I'm on Rails 6.1.7.8, rspec-rails (6.1.2), rspec-core (3.13.0), VScode 1.90.0, MacOS 14.5 on ARM (M1)
Run in terminal
:
bundle exec rspec /Users/thomas/project/spec/lib/csv_imports_lib/things_spec.rb:3
Run
:
Run options: include {:locations=>{"./spec/lib/csv_imports_lib/things_spec.rb"=>[324]}}
.
Finished in 0.19813 seconds (files took 10.59 seconds to load)
1 example, 0 failures
Coverage report generated for RSpec to /Users/thomas/project/coverage. 175 / 564 LOC (31.03%) covered.
Run options: include {:locations=>{"./spec/lib/csv_imports_lib/things_spec.rb"=>[307]}}
.
Finished in 0.02762 seconds (files took 3.81 seconds to load)
1 example, 0 failures
Coverage report generated for RSpec to /Users/thomas/project/coverage. 144 / 562 LOC (25.62%) covered.
Run options: include {:locations=>{"./spec/lib/csv_imports_lib/things_spec.rb"=>[292]}}
.
Finished in 0.11977 seconds (files took 3.81 seconds to load)
1 example, 0 failures
Coverage report generated for RSpec to /Users/thomas/project/coverage. 254 / 1408 LOC (18.04%) covered.
Run options: include {:locations=>{"./spec/lib/csv_imports_lib/things_spec.rb"=>[272]}}
.
Finished in 0.20968 seconds (files took 3.8 seconds to load)
1 example, 0 failures
Coverage report generated for RSpec to /Users/thomas/project/coverage. 267 / 1408 LOC (18.96%) covered.
Run options: include {:locations=>{"./spec/lib/csv_imports_lib/things_spec.rb"=>[250]}}
.
[...]
I'm seeing this too.
ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [x86_64-linux]
Rails 7.1.3.3
Via terminal:
Run options: include {:locations=>{"./spec/controllers/application_controller_spec.rb"=>[5]}}
.....................
Finished in 0.56302 seconds (files took 5.79 seconds to load)
21 examples, 0 failures
Via test explorer:
Fix for this would be great, makes the "Run" command pretty useless for larger spec files.
@st0012 I confirmed that this problem that occurs with latest ruby-lsp (0.20.1) and ruby-lsp-rspec (0.1.16) using Ruby 3.3.5 and Rails 7.0.8.5. How and where does the rspec is called?
Hello Stan Thank you for showing me your extension at RubyKaigi.
There's a significant time gap between the "Run" and "Run in terminal".
It looks like the entire app restart for each individual test. Is there a way to optimize the "Run" task?