Test::Unit automatic runner erroring with invalid option: --trace

I’m trying to get a project set up on CircleCI for the first time. Rails 3.2.22 on Ruby 2.2.4. Tests pass locally and in our existing CI system (i.e., not CircleCI).

I ran into this issue earlier and added Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner) to an initializer. This got me past some setup rake tasks. But when Test::Unit tasks try to run, I get the same invalid option: --trace error again.

** Invoke circleci:test_unit_0 (first_time)
** Execute circleci:test_unit_0
Coverage report generated for Functional Tests to /home/ubuntu/theapp/coverage. 7283 / 22267 LOC (32.71%) covered.
invalid option: --trace
Test::Unit automatic runner.
Usage: /home/ubuntu/.rvm/rubies/ruby-2.2.4/bin/rake [options] [-- untouched arguments]
    -r, --runner=RUNNER              Use the given RUNNER.
                                     (c[onsole], e[macs], x[ml])
        --collector=COLLECTOR        Use the given COLLECTOR.


Deprecated options:

--console Console runner (use --runner). ((bundle exec "rake circleci:test_unit_0 --trace")) returned exit code 1

Some research indicates that sometimes rspec conflicts with TestUnit in such a way that rake will generate this error. However, my Gemfile (and Gemfile.lock) does not include spec.

I’m wondering if the environment from which bundle exec is run has rspec installed. If so, how might I remove it?

You can use gem check to see if you have rspec. and you can use gem uninstall to remove it.
You can put these commands in your circle.yml probably in the pre.
Or you have enable shh in your build, and tunnel in, and run those commands yourself and see what is going on. I would recommend doing that first so you understand what is going on.
See more in the gem reference here http://guides.rubygems.org/command-reference/#gem-uninstall

rspec was not installed as far as I can tell.

I ended up writing all the test steps manually without the --trace option. Since we are on an old version of Test::Unit, I also had to write a custom test runner rake task that would accept the list of files from CircleCI.

1 Like

I’m having this same problem, would mind explaining more of what you mean by writing all the test steps manually? Or load the file you modified please? Thanks in advance.