Search code examples
rubygemsruby-on-rails-5simplecov

Rails: SimpleCov failed with exit 1 - how to solve this


I'm upgrading a rails app from rails 4.2 to 5.0. then, on to 5.1, 5.2. It is using ruby 2.6.4.

When I run my spec tests, I get the error: SimpleCov failed with exit 1. I cannot find any info specific to this using Google. I've read through the documentation for the gem, but I cannot find any info that helps me with what is causing this or how to fix it.

Gemfile:
gem 'rails', '~> 5.0'

I also made these changes in Gemfile to get bundle update rails to work.

-gem 'sass-rails', '~> 4.0.3'
+gem 'sass-rails'
-gem 'coffee-rails', '~> 4.0.0'
+gem 'coffee-rails'

Gemfile.lock (shows)
simplecov (0.18.5)
  docile (~> 1.1)
  simplecov-html (~> 0.11)
simplecov-html (0.12.2)

I do not list simplecov-html in my Gemfile, so I do not understand why Gemfile.lock shows the gem as both 0.11 and 0.12.2. Is this an issue?


To quiet a couple of un-related deprecation warnings, I had to make changes to these files. copied from git diff Noting them here, just in case...

config/environments/production.rb
-  config.serve_static_files = false
+  config.public_file_server.enabled = false
config/environments/staging.rb
-  config.serve_static_files = false
+  config.public_file_server.enabled = false
config/environments/test.rb
-  config.serve_static_files = true
+  config.public_file_server.enabled = true
-  config.static_cache_control = "public, max-age=3600"
+  config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }

Running the spec tests

jdc44@dev:~/apps/ereqs$ bundle exec rake
...
Coverage report generated for RSpec to /home/STATLER/jdc44/apps/ereqs/coverage. 3 / 892 LOC (0.34%) covered.
SimpleCov failed with exit 1
Traceback (most recent call last):
    30: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/exe/rspec:4:in `<main>'
    29: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:45:in `invoke'
    28: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:71:in `run'
    27: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:86:in `run'
    26: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:100:in `setup'
    25: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
    24: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/lib/rspec/core/configuration.rb:1433:in `each'
    23: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
    22: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.3/lib/rspec/core/configuration.rb:1435:in `load'
    21: from /home/STATLER/jdc44/apps/ereqs/spec/controllers/admins/account_codes_controller_spec.rb:1:in `<top (required)>'
    20: from /home/STATLER/jdc44/apps/ereqs/spec/controllers/admins/account_codes_controller_spec.rb:1:in `require'
    19: from /home/STATLER/jdc44/apps/ereqs/spec/spec_helper.rb:6:in `<top (required)>'
    18: from /home/STATLER/jdc44/apps/ereqs/spec/spec_helper.rb:6:in `require'
    17: from /home/STATLER/jdc44/apps/ereqs/config/environment.rb:5:in `<top (required)>'
    16: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/railties-5.0.7.2/lib/rails/railtie.rb:193:in `method_missing'
    15: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/railties-5.0.7.2/lib/rails/railtie.rb:193:in `public_send'
    14: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/railties-5.0.7.2/lib/rails/application.rb:352:in `initialize!'
    13: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/railties-5.0.7.2/lib/rails/initializable.rb:54:in `run_initializers'
    12: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
    11: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
    10: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
     9: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `call'
     8: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `each'
     7: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
     6: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
     5: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
     4: from /usr/local/rvm/rubies/ruby-2.6.4/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
     3: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/railties-5.0.7.2/lib/rails/initializable.rb:55:in `block in run_initializers'
     2: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/railties-5.0.7.2/lib/rails/initializable.rb:30:in `run'
     1: from /home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/railties-5.0.7.2/lib/rails/initializable.rb:30:in `instance_exec'

/home/STATLER/jdc44/apps/ereqs/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/railtie.rb:105:in `block in <class:Railtie>': Expected to find a manifest file in `app/assets/config/manifest.js` (Sprockets::Railtie::ManifestNeededError)
But did not, please create this file and use it to link any assets that need
to be rendered by your app:

Example:
  //= link_tree ../images
  //= link_directory ../javascripts .js
  //= link_directory ../stylesheets .css
and restart your server

I do not think the manifest.js output is related, but left it in just in case it is a clue to anyone.

Lines 18 - 21 include two files we wrote (not created by ruby/rails).

21: from /home/STATLER/jdc44/apps/ereqs/spec/controllers/admins/account_codes_controller_spec.rb:1:in `<top (required)>'
20: from /home/STATLER/jdc44/apps/ereqs/spec/controllers/admins/account_codes_controller_spec.rb:1:in `require'
19: from /home/STATLER/jdc44/apps/ereqs/spec/spec_helper.rb:6:in `<top (required)>'
18: from /home/STATLER/jdc44/apps/ereqs/spec/spec_helper.rb:6:in `require'
spec/controllers/admins/account_codes_controller_spec.rb (with line nbr)
  1 require 'spec_helper'
spec/spec_helper.rb (with line nbrs)
  1 require 'simplecov'                                                                                                                                    
  2 SimpleCov.start 'rails'                                                        
  3                                                                                
  4 # This file is copied to spec/ when you run 'rails generate rspec:install'     
  5 ENV["RAILS_ENV"] ||= 'test'                                                    
  6 require File.expand_path("../../config/environment", __FILE__)                 
  7 require 'rspec/rails'                                                          
  8 require 'capybara/rspec'                                                       
  9 require 'webmock/rspec'                                                        
 10 require 'statlerwire/spec_helpers'

I do not know of any log files that might contain any clues. I've read many threads via Google, but did not find any with my actual topic.

Any help would be greatly appreciated.

JohnC


Solution

  • Because simplecov is still showing up in your Gemfile.lock file, your best action is to delete the Gemfile.lock file and then run bundle install. This will recreate your Gemfile.lock file and simplecov should be gone.