2

I'm running parallel_tests gem on my rails project with the output for failing tests going into a file tmp/failing_specs.log. The problem is the output of this file is not in the correct format for use with 'rspec --only-failures'.

The parallel_test output file is defined in my .rspec_parallel file;

--format progress
--format ParallelTests::RSpec::SummaryLogger --out tmp/spec_summary.log
--format ParallelTests::RSpec::FailuresLogger --out tmp/failing_specs.log

The output for that failing_specs.log file is like so

Failures:

  1) Create a new debtor, shows the client after creation
     [31mFailure/Error:[0m
     [31m  [0mwithin [31m[1;31m"[0m[31m#phones-input-list[1;31m"[0m[31m[0m [32mdo[0m[0m
     [31m    [0mexpect(page).to have_selector([31m[1;31m"[0m[31mli#phone1[1;31m"[0m[31m[0m, [35mvisible[0m: [1;36mtrue[0m)[0m
     [31m  [0m[32mend[0m[0m
     [31m[0m
     [31mCapybara::ElementNotFound:[0m
     [31m  Unable to find css "#phones-input-list"[0m
     [36m# ./spec/integration/debtors/create_debtor_spec.rb:63:in `block (3 levels) in <top (required)>'[0m
     [36m# ./spec/integration/debtors/create_debtor_spec.rb:59:in `block (2 levels) in <top (required)>'[0m

The output which rspec --only-failures is expecting looks like this;

example_id                                                                  | status  | run_time        |
--------------------------------------------------------------------------- | ------- | --------------- |
./spec/controllers/accounts_controller_spec.rb[1:1:1:1:1:1]                 | unknown |                 |
./spec/controllers/accounts_controller_spec.rb[1:1:1:1:1:2]                 | unknown |                 |

How do I get these two to work together nicely?

map7
  • 5,096
  • 6
  • 65
  • 128

1 Answers1

0

Since parallel_tests spawn separate rspec processses, each one of those processes would write to the same file, which might lead to conflicts.

That is why there are those ParallelTests::RSpec::[xxx]Logger classes. I imagine it will be necessary to have a specific implementation for this case. I've opened an issue: https://github.com/grosser/parallel_tests/issues/699

Meanwhile, I think using https://github.com/NoRedInk/rspec-retry is your best solution.

Nuno Silva
  • 728
  • 11
  • 27