Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.62k stars 167 forks source link

Possible regression with Code Lens for running spec-style tests #2688

Open andyw8 opened 1 month ago

andyw8 commented 1 month ago

There seems to have been some regression with the Code Lens for running spec-style tests. On Tapioca, Kaan says it was working previously, but now it is failing, e.g.

tapioca main % bundle exec ruby -Itest /Users/andyw8/src/github.com/Shopify/tapioca/spec/tapioca/cli/annotations_spec.rb --name "/^T
apioca::AnnotationsTest(#|::)/"
/opt/rubies/3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require': cannot load such file -- spec_helper (LoadError)
        from /opt/rubies/3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /Users/andyw8/src/github.com/Shopify/tapioca/spec/tapioca/cli/annotations_spec.rb:4:in `<main>'

(this could relate to a change within Tapioca itself)

paracycle commented 1 month ago

The problem is with the -Itest part. For that project, it should be -Ispec.

vinistock commented 1 month ago

If that's the only problem, then this is a duplicate of #2308 and we can close this one.

andyw8 commented 1 month ago

I think https://github.com/Shopify/ruby-lsp/pull/2522 is partly the cause. If I try the ruby-lsp version prior to that (v0.17.17), and just change -Itest to -Ispec then it works, e.g.

bundle exec ruby -Ispec /Users/andyw8/src/github.com/Shopify/tapioca/spec/tapioca/cli/gem_spec.rb --name /must\ remove\ outdated\ RBIs/
Started with run options --name "/must remove outdated RBIs/" --seed 41260
andyw8 commented 1 month ago

This is likely related to the specs in Tapioca being within a class definition, which is a bit different from normal specs.