Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleCov only reports the last controller test and sets to 0.0% all previous results #1067

Open
OfficeYAportatil opened this issue Aug 22, 2023 · 1 comment

Comments

@OfficeYAportatil
Copy link

OfficeYAportatil commented Aug 22, 2023

Hi there!!!

I have de following issues.

My Settings:

Gemfile

ruby (3.2.2)
rails (7.0.7)
simplecov (0.22.0) # in test group

test_helper.rb

require 'simplecov
SimpleCov.start 'rails' do
    merge_timeout 2_678_400 # one month for merging 
end

ENV['RAILS_ENV'] ||= 'test'

require_relative '../config/environment'
require 'minitest/sound'
require 'rails/test_help'

Dir[Rails.root.join('test/shared_tests/**/*')].each { |f| require f }
Minitest::Sound.success = "__MINE/fx/ok_#{rand(6)}.mp3"
Minitest::Sound.failure = "__MINE/fx/er_#{rand(6)}.mp3"

module ActiveSupport
  class TestCase
    parallelize(workers: :number_of_processors)
    fixtures :all
    Faker::Config.locale = :es
    Faker::Config.random = Random.new
  end
end

Issues:

Issue #1: All controllers got a 0% when running all tests

  • When I run rails test test/controllers/ all the controllers got an 0%
  • If I run rails test test/models/, the models are correctly scored
  • If I run rails test test/system/, everything got correctly scored

Issue #2: Everything goes back to 0% with the next tests

If after rails test test/system/, I run rails test test/controllers/banks_controller_test.rb, the previous results are forgotten and I everything got scored with 0%. In the Controllers TAB only the tests for banks_controller, concerns/common_controller and application_controller got a score.

Then, if I run a new test, like rails test test/controllers/customers_controller_test.rb, everything keeps its 0% and in the Controllers TAB only the tests for customers_controller, concerns/common_controller and application_controller got a score forgetting the previos score for banks_controller

@dtgay
Copy link

dtgay commented Jan 11, 2024

Hmm, possible this is (or is related to) what I mentioned here: #1074 (comment)

EDIT: My issue was Rails test parallelization. Fix here: #718 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants