Skip to content

Conversation

@st0012
Copy link
Owner

@st0012 st0012 commented May 10, 2025

See Ruby LSP's documentation for test explorer.

ruby-lsp-rspec.test.discovery.demo.mp4

Closes #29

@st0012 st0012 added the enhancement New feature or request label May 10, 2025
@st0012 st0012 force-pushed the latest-test-resolution-support branch from e89c261 to a348b45 Compare May 10, 2025 14:58
@st0012 st0012 merged commit b083e0c into main May 10, 2025
4 checks passed
@st0012 st0012 deleted the latest-test-resolution-support branch May 10, 2025 15:21
@bjeanes
Copy link

bjeanes commented May 20, 2025

Is this missing a dependency or have specific requirements on the RSpec version? Since updating and trying the above, I get:

/usr/local/bundle/gems/ruby-lsp-rspec-0.1.23/lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb:58:in 'RubyLsp::RSpec::RSpecFormatter#uri_for': undefined method 'from_path' for class URI::Generic (NoMethodError)

        URI::Generic.from_path(path: absolute_path)
                    ^^^^^^^^^^
        from /usr/local/bundle/gems/ruby-lsp-rspec-0.1.23/lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb:25:in 'RubyLsp::RSpec::RSpecFormatter#example_started'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/reporter.rb:210:in 'block in RSpec::Core::Reporter#notify'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/reporter.rb:209:in 'Array#each'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/reporter.rb:209:in 'RSpec::Core::Reporter#notify'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/reporter.rb:129:in 'RSpec::Core::Reporter#example_started'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example.rb:474:in 'RSpec::Core::Example#start'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example.rb:440:in 'RSpec::Core::Example#fail_with_exception'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example_group.rb:614:in 'block in RSpec::Core::ExampleGroup.run'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example_group.rb:656:in 'Array#each'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example_group.rb:656:in 'RSpec::Core::ExampleGroup.for_filtered_examples'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example_group.rb:614:in 'RSpec::Core::ExampleGroup.run'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example_group.rb:608:in 'block in RSpec::Core::ExampleGroup.run'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example_group.rb:608:in 'Array#map'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/example_group.rb:608:in 'RSpec::Core::ExampleGroup.run'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/runner.rb:121:in 'block (3 levels) in RSpec::Core::Runner#run_specs'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/runner.rb:121:in 'Array#map'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/runner.rb:121:in 'block (2 levels) in RSpec::Core::Runner#run_specs'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/configuration.rb:2097:in 'RSpec::Core::Configuration#with_suite_hooks'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/runner.rb:116:in 'block in RSpec::Core::Runner#run_specs'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/reporter.rb:74:in 'RSpec::Core::Reporter#report'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/runner.rb:115:in 'RSpec::Core::Runner#run_specs'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/runner.rb:89:in 'RSpec::Core::Runner#run'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/runner.rb:71:in 'RSpec::Core::Runner.run'
        from /usr/local/bundle/gems/rspec-core-3.13.3/lib/rspec/core/runner.rb:45:in 'RSpec::Core::Runner.invoke'
        from /usr/local/bundle/gems/rspec-core-3.13.3/exe/rspec:4:in '<top (required)>'
        from /usr/local/bundle/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in 'Kernel#load'
        from /usr/local/bundle/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in 'Spring::Commands::RSpec#call'
        from /usr/local/bundle/gems/spring-4.2.1/lib/spring/command_wrapper.rb:38:in 'Spring::CommandWrapper#call'
        from /usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:226:in 'block in Spring::Application#serve'
        from /usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:190:in 'Kernel#fork'
        from /usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:190:in 'Spring::Application#serve'
        from /usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:153:in 'block in Spring::Application#run'
        from <internal:kernel>:168:in 'Kernel#loop'
        from /usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:147:in 'Spring::Application#run'
        from /usr/local/bundle/gems/spring-4.2.1/lib/spring/application/boot.rb:25:in '<top (required)>'
        from <internal:/usr/local/lib/ruby/3.4.0/rubygems/core_ext/kernel_require.rb>:136:in 'Kernel#require'
        from <internal:/usr/local/lib/ruby/3.4.0/rubygems/core_ext/kernel_require.rb>:136:in 'Kernel#require'
        from -e:1:in '<main>'

Run in Terminal has the same issue but if I remove the -r path/to/ruby_lsp_rspec/rspec_formatter then it works:

/app git:(49e7b10bf) bundle exec bin/rspec -r /usr/local/bundle/gems/ruby-lsp-rspec-0.1.23/lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb -f RubyLsp::RSpec::RSpecFormatter /app/spec/core/billing_spec.rb:8
Running via Spring preloader in process 5341
Run options: include {focus: true, locations: {"./spec/core/billing_spec.rb" => [8]}}
/usr/local/bundle/gems/ruby-lsp-rspec-0.1.23/lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb:58:in 'RubyLsp::RSpec::RSpecFormatter#uri_for': undefined method 'from_path' for class URI::Generic (NoMethodError)

        URI::Generic.from_path(path: absolute_path)
                    ^^^^^^^^^^
        [ ... snip ... ]/app git:(49e7b10bf) bundle exec bin/rspec /app/spec/core/billing_spec.rb:8              
Running via Spring preloader in process 5900
Run options: include {focus: true, locations: {"./spec/core/billing_spec.rb" => [8]}}

Randomized with seed 41148

Billing
  .debit!
    takes money out of an account
    raises on insufficient balance
    raises on negative balance

Finished in 0.82687 seconds (files took 0.23695 seconds to load)
3 examples, 0 failures

Randomized with seed 41148

@st0012
Copy link
Owner Author

st0012 commented May 21, 2025

@bjeanes Thanks for reporting. Can you open a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Run" vs "Run in terminal" time gap

2 participants