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

Using other rspec formatters #87

Open
louim opened this issue Apr 24, 2024 · 1 comment · May be fixed by #101
Open

Using other rspec formatters #87

louim opened this issue Apr 24, 2024 · 1 comment · May be fixed by #101

Comments

@louim
Copy link

louim commented Apr 24, 2024

Hey @briandunn!

First, a big thanks for putting this gem together. I'd like to know how much work would be required to allow using other rspec formatters? I'm mostly interested about using a formatter that will immediately print failure in the while the specs are still running. Eg: https://github.com/thekompanee/fuubar or https://github.com/grosser/rspec-instafail.

Would it be something possible at all?

@briandunn
Copy link
Owner

Yes, this should totally be possible. There is already an API for implementing Flatware formatters. These are the methods that will be called on your formatter: https://github.com/briandunn/flatware/blob/master/lib/flatware/broadcaster.rb#L6-L13
Here is where the built in RSpec console formatter is instantiated: https://github.com/briandunn/flatware/blob/master/lib/flatware/rspec/cli.rb#L20-L23

Roughly the steps to implement one of those:

  1. restore the formatter CLI option.
  2. write an adapter from the Flatware events to the RSpec events, similar to https://github.com/briandunn/flatware/blob/master/lib/flatware/rspec/formatters/console.rb.

It may be possible to write a general adapter that make most rspec formatters work. that would be cool.

@tomasdundacek tomasdundacek linked a pull request Oct 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants