You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a gem, which was initialized using the bundler gem tooling. After initializing the gem, I added a dependency on simplecov for development and configured it per instructions. However, when I run commands (like bundle exec rake, which is configured to run tests and rubocop), I get output, as shown below, that indicates the coverage report is being generated before test execution.
At first, I thought it had to do with the initialization of application code before simplecov, but it looks like the only thing being initialized is the standard version.rb file. It appears to be a timing of generation versus test based on the console output.
In the reproduction example repository, I would expect no coverage of lib/simplecov-bug-demo/version.rb, because this file is required in the gemspec. However, I would expect lines 7-8 of lib/simplecov-bug-demo/commands/command.rb to be covered. However, neither line is covered. Only the module, class, and method declaration lines are covered, which is what I would expect for simply loading the file after executing simplecov.
Without a .simplecov file, the console output of bundle exec rake looks like:
Coverage report generated for Minitest to /workspaces/simplecov-bug-demo/coverage.
Line Coverage: 75.0% (9 / 12)
Run options: --seed 44598
# Running:
..
Finished in 0.001718s, 1164.1532 runs/s, 1164.1532 assertions/s.
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
With a .simplecov file, the console output of bundle exec rake is:
I'm using Ruby 3.3 inside a devcontainer built on top of a Ruby 3.3 docker image. Minitest is at version 5.25.1, Rake at 13.2.1, and simplecov at 0.22.0.
The underlying cause may be the same as #1099. However, that issue does talk specifically about Rails, which is not involved in my project.
The text was updated successfully, but these errors were encountered:
I asked about this in a Stack Overflow question and got an answer from mitch_. The solution was, as described, to add SimpleCov.external_at_exit = true before the SimpleCov.start in the test_helper.rb file. I also did have to convert the start to a block and explicitly filter the vendor and test directories.
If this doesn't represent a bug in SimpleCov, it would be worth updating the readme to describe how to integrate SimpleCov with minitest. If there's a more appropriate solution, it would be good to get that out into the world as well.
I was able to put together a very simple repository that demonstrates the issue, including committing the coverage files.
https://github.com/ThomasOwens/simplecov-bug-demo
I'm building a gem, which was initialized using the
bundler gem
tooling. After initializing the gem, I added a dependency on simplecov for development and configured it per instructions. However, when I run commands (likebundle exec rake
, which is configured to run tests and rubocop), I get output, as shown below, that indicates the coverage report is being generated before test execution.At first, I thought it had to do with the initialization of application code before simplecov, but it looks like the only thing being initialized is the standard
version.rb
file. It appears to be a timing of generation versus test based on the console output.In the reproduction example repository, I would expect no coverage of lib/simplecov-bug-demo/version.rb, because this file is required in the gemspec. However, I would expect lines 7-8 of lib/simplecov-bug-demo/commands/command.rb to be covered. However, neither line is covered. Only the module, class, and method declaration lines are covered, which is what I would expect for simply loading the file after executing simplecov.
Without a
.simplecov
file, the console output ofbundle exec rake
looks like:With a
.simplecov
file, the console output ofbundle exec rake
is:I'm using Ruby 3.3 inside a devcontainer built on top of a Ruby 3.3 docker image. Minitest is at version 5.25.1, Rake at 13.2.1, and simplecov at 0.22.0.
The underlying cause may be the same as #1099. However, that issue does talk specifically about Rails, which is not involved in my project.
The text was updated successfully, but these errors were encountered: