Search code examples
rubyrakeminitestguard

Guard warning "warning: loading in progress, circular require considered harmful"


I have a simple Ruby test envinvorment set up with: minitest, guard, guard-minitest, and terminal-notifier-guard.

I'm using the following Rakefile so my tests are run by default because that's what Travis CI does by default.

require 'rake/testtask'
task :default => [:test]
Rake::TestTask.new do |t|
  t.libs << 'test'
  t.pattern = "test/test_*"
end

The tests do run and pass but I get multiple screens worth of warnings. I found an answer and another answer.

But it seems like those solutions are specific to rails and rspec.

Why am I getting these warnings?

You can find the full project on GitHub and the full error output in this gist


Solution

  • If you just want to turn off the warnings, you can do so in the rake test task setup:

    require 'rake/testtask'
    task :default => [:test]
    Rake::TestTask.new do |t|
      t.libs << 'test'
      t.pattern = "test/test_*"
      t.warning = false
    end