- Add
rspec_reproducible_order_command.rb
tolib/
. - Use the formatter when running RSpec, in addition to usual formatters:
rspec --format progress --format RspecReproducibleOrderCommand --out log/rspec_command.txt
- Shortened example output:
rspec --order random:27344 ./spec/models/user_spec.rb:4 ...
In .circleci/config.yml
:
- run:
name: RSpec
command: |
mkdir -p $CIRCLE_TEST_REPORTS/rspec
bundle exec rspec \
--format RspecJunitFormatter --out $CIRCLE_TEST_REPORTS/rspec/rspec.xml \
--format RspecReproducibleOrderCommand --out log/rspec_command.txt \
--format progress \
$(circleci tests glob 'spec/**/*_spec.rb' | circleci tests split --split-by=timings | xargs)
- run:
name: Command for reproducible test run
when: on_fail
command: |
cat log/rspec_command.txt
#
# Use the following command to reproduce this exact RSpec run,
# with the same examples in the same order
# (you can triple-click to select the whole line):