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

Run all tests on Enter press #209

Closed
wants to merge 8 commits into from

Conversation

klevo
Copy link

@klevo klevo commented Aug 3, 2024

I'm looking for a replacement for Guard and I really like retest. The thing I miss is being able to run all tests with just a single keypress when desired. So here it goes.

Further this PR includes a change to the default Rails command for running all tests. Currently it would not include the system tests, when it's invoked with just "rails test". To really include all tests, including system tests, "rails test:all" needs to be used.

@AlexB52
Copy link
Owner

AlexB52 commented Aug 4, 2024

Hi @klevo
Thanks for your contribution.
You are tackling an issue I've been meant to do for a long time. Unfortunately, I cannot merge the current PR for several reasons. There are two things added:

  1. bin/rails test:all
  2. listening to stdin

Both features have some issues that require a bit more work.

bin/rails test:all

Unless mistaken, a quick overview shows that the bin/rails test:all has been introduced back in 7.1 which means that any app with rails <7.1 will not understand what test:all is supposed to do (Rails version to be confirmed). Retest supports Ruby >= 2.5 and, therefore, affects the Rails versions we currently support as well. If we can confirm that every single rails version usable with Ruby 2.5 can use bin/rails test:all then this is a straightforward change. Otherwise we need to identify the rails version currently used.

Additional work:

  • Identifying rails version to know whether we can use test:all
  • Adding a new docker feature spec that tests system test are run on the newer version

I've created an issue #210. It is a fair amount of work left and I'm happy to merge some of your changes if you can remove the listening part and give a solution to identify the rails version. I will add a new docker system tests later to include that change in our CI pipeline. If you're not keen on taking on the additional changes. I'm happy to look at this next and make it available when using the command retest --all in the next patch release.

Note: This change will be released in v1.13.3 once tested on several Rails app versions.

Listening to stdin

This is the main piece of work I'm supposed to tackle for V2. I've tried the current implementation, and it conflicts with the only input required when multiple test files are available. Retest asks you to confirm which test to run which would not be captured because we're already listening to getc on a loop.

Additional work:

  • Balancing different STDIN input based on whether a question is asked or not.

This is issue #174. I will handle this change personally as this is the main change for release v2.
Note: I don't have a timeline for this change just yet but will do my best to release it soonish

@klevo
Copy link
Author

klevo commented Aug 5, 2024

Hey @AlexB52 - thanks for the detailed reply, it all makes sense. I'll close this PR, and rather open a new one for the :all issue with Rails version detection, once I have time to look into that. Once again, great project and I'm looking forward to v2 ✊

@klevo klevo closed this Aug 5, 2024
@AlexB52
Copy link
Owner

AlexB52 commented Aug 13, 2024

Hi @klevo,

I have pushed a pre-version of Retest 2.0.0. You can install it here with gem install retest --pre
You now have access to several commands from the terminal.

Launching retest will now show an interactive panel with a couple of commands to test.
You can now run all the tests with ra or run all entry. Note this doesn't run the system tests as you correctly observed.

Type interactive command and press enter
> h

* 'h' or 'help'    -> Prints help
* 'p' or 'pause'   -> Pauses Retest. Tests aren't run until unpaused.
* 'u' or 'unpause' -> Unpauses Retest
* <Enter>          -> Runs last changed triggered command
* 'ra', 'run all'  -> Runs all tests
* 'e' or 'exit'    -> Exits Retest

Here is the open discussion to collect feedback on the proof of concept

Let me know what you think if you have time to check it out. This can be changed and improved upon.

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 this pull request may close these issues.

2 participants