Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unify verbose formatter with other loggers #927

Merged
merged 2 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions Readme.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading