Skip to content

Commit

Permalink
unify verbose formatter with other loggers
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Dec 24, 2023
1 parent e6f7aa5 commit 4ba55a3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
34 changes: 18 additions & 16 deletions Readme.md
Expand Up @@ -164,6 +164,24 @@ Add to `.rspec_parallel` or use as CLI flag:

(Not needed to retry failures, for that pass [--only-failures](https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures) to rspec)


RSpec: VerboseLogger
-----------------------

Prints a single line for starting and finishing each example, to see what is currently running in each process.

```
# PID, parallel process number, spec status, example description
[14403] [2] [STARTED] Foo foo
[14402] [1] [STARTED] Bar bar
[14402] [1] [PASSED] Bar bar
```

Add to `.rspec_parallel` or use as CLI flag:

--format ParallelTests::RSpec::VerboseFormatter


Cucumber: FailuresLogger
-----------------------

Expand All @@ -183,22 +201,6 @@ To rerun failures:

cucumber @tmp/cucumber_failures.log

Formatters
==========

RSpec: VerboseFormatter

Output the RSpec PID, parallel process number, spec status, and the full
example description. The formatter outputs one line when starting an example
and then again when finishing. Use like the RSpec documentation but plays
nicely with parallel processes.

Usage:

```console
$ parallel_rspec -- --format ParallelTests::RSpec::VerboseFormatter --
```

Setup for non-rails
===================

Expand Down
Expand Up @@ -3,7 +3,7 @@
require 'rspec/core/formatters/base_text_formatter'
require 'parallel_tests/rspec/runner'

class ParallelTests::RSpec::VerboseFormatter < RSpec::Core::Formatters::BaseTextFormatter
class ParallelTests::RSpec::VerboseLogger < RSpec::Core::Formatters::BaseTextFormatter
RSpec::Core::Formatters.register(
self,
:example_group_started,
Expand Down
Expand Up @@ -2,7 +2,7 @@

require 'spec_helper'

describe ParallelTests::RSpec::VerboseFormatter do
describe ParallelTests::RSpec::VerboseLogger do
def run(command)
result = IO.popen(command, err: [:child, :out], &:read)
raise "FAILED: #{result}" unless $?.success?
Expand Down Expand Up @@ -39,7 +39,7 @@ def run(command)
"#{repo_root}/bin/parallel_rspec",
"-n", "2",
"--",
"--format", "ParallelTests::RSpec::VerboseFormatter",
"--format", "ParallelTests::RSpec::VerboseLogger",
"--"
]

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -8,7 +8,7 @@
require 'parallel_tests/test/runtime_logger'
require 'parallel_tests/rspec/runtime_logger'
require 'parallel_tests/rspec/summary_logger'
require 'parallel_tests/rspec/verbose_formatter'
require 'parallel_tests/rspec/verbose_logger'

String.class_eval do
def strip_heredoc
Expand Down

0 comments on commit 4ba55a3

Please sign in to comment.