Skip to content

Commit

Permalink
unify verbose formatter with other loggers (#927)
Browse files Browse the repository at this point in the history
* typo

* unify verbose formatter with other loggers
  • Loading branch information
grosser committed Dec 25, 2023
1 parent 7291dfd commit 14933b0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
36 changes: 19 additions & 17 deletions Readme.md
Expand Up @@ -151,7 +151,7 @@ Add the following to your `.rspec_parallel` (or `.rspec`) :
RSpec: FailuresLogger
-----------------------

Produce pastable command-line snippets for each failed example. For example:
Produce pasteable command-line snippets for each failed example. For example:

```bash
rspec /path/to/my_spec.rb:123 # should do something
Expand All @@ -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::VerboseLogger


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 14933b0

Please sign in to comment.