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

Allow customising the bisect formatter #2978

Open
tubaxenor opened this issue Nov 9, 2022 · 6 comments
Open

Allow customising the bisect formatter #2978

tubaxenor opened this issue Nov 9, 2022 · 6 comments

Comments

@tubaxenor
Copy link
Contributor

tubaxenor commented Nov 9, 2022

Currently bisect runner has 2 formatters: https://github.com/rspec/rspec-core/blob/main/lib/rspec/core/invocations.rb#L46-L47
Since they are not configurable, currently we can only parse the result from either stdout or monkey patch the formatter's bisect_repro_command method to get the repro from bisect notifier: https://github.com/rspec/rspec-core/blob/main/lib/rspec/core/bisect/coordinator.rb#L35

Is it currently possible to add customized formatters to bisect runner? Or is it ok to put up a PR to support this feature?

@pirj
Copy link
Member

pirj commented Nov 9, 2022

Can you monkey patch Bisect#bisect_formatter_klass_for and return your own formatter class from it?

@tubaxenor
Copy link
Contributor Author

That's still monkey patch... Just wondering if there is a more official way or should be an official support for this 😅

@pirj
Copy link
Member

pirj commented Nov 9, 2022

Eventually, if there's demand. I can't really remember this request popping up while I contribute to RSpec.
It's a relatively small change code-wise, but that formatter part of the private API would have to be made public and documented.
I encourage you to monkey-patch for now, since there's low risk of this code to change, and if there's more people asking for to use custom bisect formatters, we'll consider accepting a PR.

It would be wonderful to describe your use case.

@pirj pirj closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2022
@tubaxenor
Copy link
Contributor Author

tubaxenor commented Nov 10, 2022

It would be wonderful to describe your use case.

@pirj thanks for your reply. The use case for us is to build a flaky test analyzer, which we first took out failed spec batches and put each one of them to our CI nodes with --bisect options to catch the issued spec example/file. At the end of the process, we would like to gather the end result after bisecting, which basically is the repro returning after bisect runner execution.

It would be nice if the bisect runner can have the same ability as normal runner to take formatters to register on different notifications and act on them accordingly. But since I am the only one request it for now, it's reasonable to just monkey patch the code on our end 👍

@JonRowe JonRowe changed the title Customize bisect formatter Allow customising the bisect formatter Nov 10, 2022
@JonRowe JonRowe reopened this Nov 10, 2022
@JonRowe
Copy link
Member

JonRowe commented Nov 10, 2022

I think this is a reasonable request, the bisect formatter is not the same api as our normal formatters, but the same principles could be used to make this happen. I'm not sure it will be a priority for anyone on the core team but if you'd like to work on it @tubaxenor I'm happy to help review it.

@tubaxenor
Copy link
Contributor Author

I can try spend some time and work on this later this month, thanks for reopen this 🙇

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

No branches or pull requests

3 participants