RSpec returning with code 1

Hello,
I’m not sure why but RSpec is returning on my circleCI environment with error code 1 despite all tests passing?

Warning: NLS_LANG is not set. fallback to US7ASCII.
WARNING: Unexpected middleware set after the adapter. This won't be supported from Faraday 1.0.
WARNING: Unexpected middleware set after the adapter. This won't be supported from Faraday 1.0.
Run options:
  include {:focus=>true}
  exclude {:broken=>true}

All examples were filtered out; ignoring {:focus=>true}

Top 10 slowest examples (5.52 seconds, 39.9% of total time):
  CloneStyleService#clone with a basic style only calls the style's writeback once
    1.55 seconds ./spec/services/clone_style_service_spec.rb:40
  CloneStyleService#clone with a basic style ignores color priority attribute and copies colors in id order
    0.50374 seconds ./spec/services/clone_style_service_spec.rb:335
  CloneStyleService#clone with a basic style blanks out supporting image image data
    0.47192 seconds ./spec/services/clone_style_service_spec.rb:350
  CloneStyleService#clone with a basic style only sets some attributes to nil
    0.44804 seconds ./spec/services/clone_style_service_spec.rb:55
  CloneStyleService#clone with a basic style copies all colors except retired colors
    0.44649 seconds ./spec/services/clone_style_service_spec.rb:128
  CloneStyleService#clone with a basic style resets 'deployed_at' and 'deploy_type' on new colors
    0.43403 seconds ./spec/services/clone_style_service_spec.rb:153
  CloneStyleService#clone with a basic style copies complementary styles to have the same groups if include_complements is true
    0.43389 seconds ./spec/services/clone_style_service_spec.rb:195
  CloneStyleService#clone with a basic style creates the other one-to-many relations with matching important data
    0.41101 seconds ./spec/services/clone_style_service_spec.rb:163
  CloneStyleService#clone with a basic style creates the same number of one-to-many relations
    0.41083 seconds ./spec/services/clone_style_service_spec.rb:94
  CloneStyleService#clone with a basic style creates view image records without copying any image data
    0.40754 seconds ./spec/services/clone_style_service_spec.rb:306

invalid option: --profile

minitest options:
    -h, --help                       Display this help.
        --no-plugins                 Bypass minitest plugin auto-loading (or set $MT_NO_PLUGINS).
    -s, --seed SEED                  Sets random seed. Also via env. Eg: SEED=n rake
    -v, --verbose                    Verbose. Show progress processing files.
    -n, --name PATTERN               Filter run on /regexp/ or string.
    -e, --exclude PATTERN            Exclude /regexp/ or string from run.

Known extensions: rails, pride
    -b, --backtrace                  Show the complete backtrace
    -d, --defer-output               Output test failures and errors after the test run
    -f, --fail-fast                  Abort test run on first failure or error
    -c, --[no-]color                 Enable color in the output
    -p, --pride                      Pride. Show your testing pride!
Coverage report generated for RSpec to /home/circleci/mms/coverage. 1648 / 5948 LOC (27.71%) covered.
Exited with code 1

I don’t understand why it’s complaining about the arguments. They work just fine on another project.
Invoking the command like this :

#!/bin/bash -eo pipefail
bundle exec rspec --fail-fast --profile 10 --require rspec_junit_formatter --format RspecJunitFormatter --out ./tmp/test-results/rspec/results.xml $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)

Hi Arne. Looks like rspec doesn’t like the --profile flag here. Are you using the same version of ruby and rspec in the other project? Are you maybe caching dependencies in one of them so you are getting a different version?

Should not be the issue. Running RSpec 3.8.0 according our Gemfile, so this should be working just fine really… I don’t have this output locally when running the exact same command, so not sure what’s causing this

I think running an SSH job and trying the command manually would help in this case, then.

https://circleci.com/docs/2.0/ssh-access-jobs/

running it now with an additional formatter for output, maybe it doesn’t like some of the output, I don’t know…

Okay,

I’ve used the SSH to get onto the box, and it seems as soon as I pass in the --format option to RSpec it doesn’t like this. Which makes no sense, because this is a core feature of RSpec.

I’ve opened an issue with RSpec about this, but none of it makes sense.
This is just supposed to work.

1 Like

Looks like someone is having trouble with --format here too. I wonder if there is a bug where, by virtue of running it in a particular environment - say with env vars missing - it reports a rather unhelpful error? In this case, someone is trying to run the command from within an IDE, which may also tamper with RSpec’s environment.

1 Like

I’ve actually resolved the issue.
The problem is that when you run RSpec, and your code is auto-loading minitest or test-unit, their runners get confused and try to parse the arguments you hand over to RSpec.
It’s not RSpec that’s returning the error code 1, it’s actually minitest.

In our case, we had the line require rails/test_helper in our specs, which loaded minitest.
As soon as I removed that line, everything worked normally.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.