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

"Run" vs "Run in terminal" time gap #29

Open
D-system opened this issue May 28, 2024 · 6 comments
Open

"Run" vs "Run in terminal" time gap #29

D-system opened this issue May 28, 2024 · 6 comments

Comments

@D-system
Copy link

Hello Stan
Thank you for showing me your extension at RubyKaigi.

There's a significant time gap between the "Run" and "Run in terminal".

image

It looks like the entire app restart for each individual test. Is there a way to optimize the "Run" task?

@st0012
Copy link
Owner

st0012 commented Jun 13, 2024

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.

@D-system
Copy link
Author

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]}}
.

[...]

@dijonkitchen
Copy link

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:
image

@navels
Copy link

navels commented Aug 26, 2024

Fix for this would be great, makes the "Run" command pretty useless for larger spec files.

@D-system
Copy link
Author

@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?

@malcolmohare
Copy link

malcolmohare commented Nov 8, 2024

The main plugin has an open issue for this: Shopify/ruby-lsp#2402

The test execution loop in the extension is here. It will execute anything marked with the 'example' tag. But it will also enqueue any children of that node to be potentially run. So even if we changed the codelens response from the rspec extension to tag the context/describe codelens commands with 'example', the current extension code would still run the children in their own processes.

and then there is the issue of how to pluck the success/error responses from the stdout of the test and properly populate the test explorer ui.

it looks like someone tried to do it for minitest but gave up, and the maintainers from shopify claim its on their roadmap to address eventually.

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

5 participants