retest

A simple CLI to watch file changes and run their matching Ruby specs. Works on any ruby projects with no setup.

MIT License

Downloads
108.2K
Stars
141
Committers
3
retest - No prod impact Latest Release

Published by AlexB52 8 months ago

This release fixes on our CI pipeline and the bundler version set incorrectly in the previous release v1.13.1

retest - Adding observer as an explicit dependency

Published by AlexB52 8 months ago

Ruby 3.4 will require the observer gem to be set as an explicit dependency in a Gemfile and will no longer be included in the language: https://bugs.ruby-lang.org/issues/20187

This release adds observer gem as an explicit Retest dependency.

retest - Update possible test list & minor maintenance improvements

Published by AlexB52 8 months ago

In this release, apparent changes are on the list of possible options:

  1. We added a none option when no test file matches the file changed #49
  2. We added a > at the end to improve user feedback #192
  3. We require Listen version v3.9.0 as a dependency #195

The list looks like this now

We found few tests matching: app/models/valuation/holdings.rb

[0] - test/models/taxation/holdings_test.rb
[1] - test/models/schedule/holdings_test.rb
[2] - test/models/holdings_test.rb
[3] - test/models/performance/holdings_test.rb
[4] - test/lib/csv_report/holdings_test.rb
[5] - none

Which file do you want to use?
Enter the file number now:
> 

In minor improvements with no impact

  • We remove some deprecation warnings in our test suite
  • We remove a monkey patch after https://github.com/guard/listen/issues/572 has been fixed #195
  • We test a new way to read other processes output in feature test
  • We upgrade some github actions #197
retest - Warnings, notifications and new version flag

Published by AlexB52 11 months ago

This release adds a few changes

  • When using --notify, retest is now making a sound after asking to select a file when in doubt
  • We're disabling the symlink warnings that happen on some repositories when files are already watched. Happens regularly with node_modules. These warnings have been moved to the Listen.logger dependency and available with LISTEN_GEM_DEBUGGING=warn
  • We're introducing a new option --verbose, -v` to see which version of retest we're currently using

These issues are fixed:

  • #176
  • #177
  • #181
retest - Improve test file selection

Published by AlexB52 about 1 year ago

The release improves the identification of test files with test and spec prefix or suffix.
The release also updates some dependencies suggested by Dependabot.

Main change:

  • #138 - Retest defaults to test_*.rb pattern even when *_test.rb file exists
retest - Update name pattern for test files

Published by AlexB52 about 2 years ago

Since December 2021, Bundler gem now defaults to test_filename.rb instead of filename_test.rb in release 2.3.0

bundle gem generated MiniTest file and class now start with 'test' https://github.com/rubygems/rubygems/pull/3893

This release addresses this change by updating what's considered a test file when matching specs.

A change in filename.rb will now consider these files as possible matches:

  • filename_test.rb
  • filename_spec.rb
  • test_filename.rb
  • spec_filename.rb (because why not)
retest - Gracefully exit retest when pressing Ctrl+c

Published by AlexB52 over 2 years ago

Someone suggested to gracefully exit Retest when pressing ctrl + c instead of showing the ruby trace: #124

This release enables the software to print "Goodbye" after exiting retest.

retest - Listen file changes with the polling method

Published by AlexB52 over 2 years ago

Some filesystems won't work without polling (VM/Vagrant Shared folders, NFS, Samba, sshfs, etc.).
https://github.com/guard/listen#issues--limitations

In this situation we introduce a new flag --polling to force the polling method on the Listen gem when using retest

Examples:

$ retest --polling
$ retest --polling --all 
$ retest --polling 'bundle exec rubocop <changed>'
retest - Remove the --auto option and update help text

Published by AlexB52 over 2 years ago

The --auto option is run by default, there is no need to make it explicit.

  • We remove the --auto option
  • We also update the help text when running retest -h
# Old behaviour
    $ retest --auto
    $ retest --auto --all 

# New behaviour
    $ retest 
    $ retest --all

This release fixes:

  • #116
  • #117
retest - Change starting sound and copy changes

Published by AlexB52 over 2 years ago

We play another sound when restest starts.
Using the same sound of a test passing and retest starting is confusing.
The sounds should be distinct otherwise it feels like Retest ran the suite.

A minor change updating a copy to make things a bit clearer.

This release includes:
#108
#112

Fixing:
#82

retest - Enable Sound Feedback

Published by AlexB52 over 2 years ago

For macOS only (for now)

You can now get sound feedback when your tests pass or fail.
Add the --notify flag on your retest command to enable sound. You should hear a sound as your start Retest and on all the runs.

Why? This removes the need to see the terminal window while refactoring code. 🎉

Here are some valid uses of the notify flag:

$ retest --notify
$ retest --all --notify
$ retest --notify 'ruby <changed>'

This release includes:

  • #89
retest - Add <changed> placeholder

Published by AlexB52 about 3 years ago

This releases allows the developer to use the placeholder in the retest command. Something like this: retest 'bin/rails <test> && rubocop <changed>

This command will both find the matching test, the changed file and replace the placeholders accordingly.

Retest can be used with <test> and/or <changed>

retest 'rubocop <changed>'
retest 'bin/rails test <test>'
retest 'bin/rails test <test> && rubocop <changed>'
retest 'bin/rails test <test> && rubocop <test> <changed>'

Rules

If we have a post.rb and post_test.rb files. Here are the different scenarios and rules:

A change on post.rb results in:

  • <changed> => post.rb
  • <test> => post_test.rb

A change on post_test.rb results in:

  • <changed> => post_test.rb
  • <test> => post_test.rb
retest - Add --ext argument

Published by AlexB52 about 3 years ago

This release includes the ability to listen to other extensions than the /\.rb$/ regex.

For now, this extension is really just useful for hardcoded commands. An example of usage can be:

$ retest 'go test' --ext=\\.go$

This is a first step towards opening retest to other programming languages.

Note: Using placeholders e.g. <test> will probably not work as finding test files is still coupled to ruby extensions. We'll look into changing this in future releases.

retest - Run diffs in one go

Published by AlexB52 about 3 years ago

The flag --diff now runs all the spec files in one run instead of looping through each of them.

Example:

retest --diff main

Setup identified: [RSPEC]. Using command: 'bin/rspec <test>'
Tests found:
  - spec/path/to/file1_spec.rb
  - spec/path/to/file2_spec.rb
  - spec/path/to/file3_spec.rb
Running tests...
Test File Selected: spec/path/to/file1_spec.rb spec/path/to/file2_spec.rb spec/path/to/file3_spec.rb
Running via Spring preloader in process 10493
................................................................................................................................................................................................................

Finished in 16.97 seconds (files took 0.69523 seconds to load)
208 examples, 0 failures
retest - Add support for a ruby project without Gemfile

Published by AlexB52 over 3 years ago

Retest auto flag will now find the correct command to run automatically with a ruby folder without a Gemfile.
Something as simple as:

ruby-bare
├── program.rb
└── program_test.rb

0 directories, 2 files
retest - Bin commands

Published by AlexB52 over 3 years ago

This release includes a performance boost using /bin/ files rather than bundle exec commands when possible.

When your ruby repository has a bin file such as bin/rake, bin/rspec, bin/rails this file will be used instead of its corresponding bundle exec command.

retest - Diff Feature

Published by AlexB52 over 3 years ago

This release includes a new feature: Diff feature used with the --diff option.
It helps you run a sanity check only on specs related your current changes against a branch. So that you don't run the whole suite locally but still gets a check before triggering a full CI suite once pushed.

retest --diff origin/main

The release also has minor improvements on file search depending on the command you run

retest - Auto Flag

Published by AlexB52 over 3 years ago

You can now run retest without passing a command in quotes and retest will find out the appropriate command to run.
Works with --all flag too. Examples:

retest
retest --all
retest --auto
retest --auto --all

Those are equivalent

retest
retest --auto
retest - Docker Integration Tests

Published by AlexB52 over 3 years ago

This release has no impact on the current retest CLI but is really exciting! 🙌

We now have a reliable setup to test retest CLI in different ruby environments. So far there are three environments:

  • rails
  • hanami
  • ruby

Those E2E tests will increase our confidence in providing a stable and 'it just works' experience moving forward with development ❤️

retest - Issue - Watch untracked files

Published by AlexB52 over 3 years ago

Retest now watches untracked files from a repository after launch on top of adding new files and deleting files when running.