st0012 / ruby-lsp-rspec

A Ruby LSP addon for RSpec tests
MIT License
127 stars 7 forks source link

Passing tests appear to have failed #24

Open jar349 opened 8 months ago

jar349 commented 8 months ago

In a terminal, running: bundle exec rspec runs all my tests in ./spec and they all pass.

In the Testing pane of VS Code, I run some tests and they pass but appear visibly to have failed. See the image below and note the 1 example, 0 failures

Image

I have this in the development group of my Gemfile:

  gem "ruby-lsp", "~> 0.14.3"
  gem "ruby-lsp-rspec", "~> 0.1.10"
jar349 commented 8 months ago

I suspect that this may be due to this:

Image

note:

Line coverage (27.16%) is below the expected minimum coverage (100.00%).
SimpleCov failed with exit 2 due to a coverage related error

The problem I have is that SimpleCov is configured in ./specs/spec_helper.rb to require full coverage:

SimpleCov.minimum_coverage 100

But with ruby-lsp-rspec, there doesn't seem to be a way to just run all tests? The code lenses are contextual in a single file. I need a way to run all tests so that my coverage will be at 100% and rspec will exit with code zero.

jar349 commented 7 months ago

So the problem I have with only being able to run the tests from a code lens is that I don't have a way to run ALL the tests in my repo at once, which means my coverage metrics will always fail my tests.

Would it be possible to add a way to run all the tests in a repo?

malcolmohare commented 1 month ago

Is there a way to provide an ENV for the CodeLens to include in the test invocation? Then you could gate the simplecov config with something like ENV['SIMPLECOV_DISABLED'] == true. Right now I've just done that via .env file that differs from my CI one, but it'd be cleaner if its something I could configure for the VS Code workspace instead.