simplecov-ruby / simplecov

Code coverage for Ruby with a powerful configuration library and automatic merging of coverage across test suites
MIT License
4.78k stars 553 forks source link

Coverage is generated before tests finished running. #1099

Open ItaloCobains opened 5 months ago

ItaloCobains commented 5 months ago

This is my test_helpers.rb

Note that I commented on parallel tests.

# frozen_string_literal: true

ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
require "mocha/minitest"

require "simplecov"

SimpleCov.start "rails"

# Allows creating dynamic routes for tests
Rails.application.routes.disable_clear_and_finalize = true

I18n.locale = :en

# Make tests think we have PADDLE configuration set up
ENV["PADDLE_API_KEY"] = "API_KEY"
ENV["PADDLE_PRODUCT_ID"] = "pro_01"
ENV["PADDLE_ENVIRONMENT"] = "sandbox"
ENV["PADDLE_VENDOR_ID"] = "14025"
ENV["PADDLE_SECRET_KEY"] = "pdl_nt"

# Test plans
PADDLE_PLANS = []
STRIPE_PLANS = []

class ActiveSupport::TestCase
  # Call i18n.t() with just t()
  include AbstractController::Translation
  include ActionDispatch::TestProcess

  # Run tests in parallel with specified workers
  # parallelize(workers: ENV.fetch("PARALLEL_WORKERS", :number_of_processors))

  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
  fixtures :all

  # Devise helpers
  include Warden::Test::Helpers
  Warden.test_mode!

  teardown do
    Warden.test_reset!
  end

  def log_in(user, opts = {})
    login_as(user, opts)
  end

  def log_out(*scopes)
    logout(*scopes)
  end
end
 rails test:all
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.12s.
yarn run v1.22.22
$ esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds

  app/assets/builds/application.js      1.1mb ⚠️
  app/assets/builds/application.js.map  1.9mb

Done in 0.19s.
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.19s.
yarn run v1.22.22
$ tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme

Rebuilding...

Done in 1219ms.
Done in 1.99s.
DEPRECATION WARNING: `Rails.application.secrets` is deprecated in favor of `Rails.application.credentials` and will be removed in Rails 7.2. (called from <main> at /home/italo/Documents/tryhub/config/environment.rb:7)
2024-06-24 11:49:22 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger:
  https://selenium.dev/documentation/webdriver/troubleshooting/logging

2024-06-24 11:49:22 WARN Selenium [DEPRECATION] DriverFinder.path(options, service_class) is deprecated. Use DriverFinder.new(options, service).driver_path instead.
Coverage report generated for Minitest to /home/italo/Documents/tryhub/coverage. 27 / 2437 LOC (1.11%) covered.
Run options: --seed 34549

# Running:

Capybara starting Puma...
* Version 6.4.2, codename: The Eagle of Durango
* Min threads: 0, max threads: 4
* Listening on http://127.0.0.1:37313
......................................................................................................................................................................................................................................................................................................................................................................................

Finished in 135.056046s, 2.7692 runs/s, 5.2423 assertions/s.
374 runs, 708 assertions, 0 failures, 0 errors, 0 skips

For some reason that I don't know what it is, it returns before finishing the tests, I thought it was the parallel tests but apparently not, I didn't find anything on the internet that solved my problem, thank you in advance.