Ruby + rspec - invalid byte sequence in UTF-8 (ArgumentError)

circle.yml

#1

I recently started using Ruby 2.5.0 and now our CircleCI Enterprise is returning an error when running coverage:

# The machine section is required to support ruby 2.5.0
# See: https://discuss.circleci.com/t/ruby-2-5-0-builds-failing-on-circleci-1-0-due-to-missing-home-travis/19620
machine:
  pre:
    - sudo ln -s /opt/circleci /home/travis
  ruby:
    version: 2.5.0

test:
  pre:
    - bundle exec rubocop -D
  override:
    - bundle exec rspec --require spec_helper spec --format documentation

The tests all run and pass, but then Circle fails on running the coverage.

Finished in 0.36838 seconds (files took 3.18 seconds to load)
32 examples, 0 failures

Traceback (most recent call last):
	11: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov/defaults.rb:68:in `block in <top (required)>'
	10: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov/configuration.rb:180:in `block in at_exit'
	 9: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov.rb:82:in `result'
	 8: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov.rb:63:in `add_not_loaded_files'
	 7: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov.rb:63:in `each'
	 6: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov.rb:66:in `block in add_not_loaded_files'
	 5: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov/lines_classifier.rb:20:in `classify'
	 4: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov/lines_classifier.rb:20:in `map'
	 3: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov/lines_classifier.rb:20:in `each'
	 2: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov/lines_classifier.rb:20:in `foreach'
	 1: from /home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov/lines_classifier.rb:21:in `block in classify'
/home/ubuntu/darwin/vendor/bundle/ruby/2.5.0/gems/simplecov-0.15.1/lib/simplecov/lines_classifier.rb:21:in `=~': invalid byte sequence in UTF-8 (ArgumentError)

bundle exec rspec --require spec_helper spec --format documentation returned exit code 1

Everything works fine locally. How should I troubleshoot this?


#3

Possible solution here found using this search. Any good?


#4