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

Fix Kernel system type error when hitting enter upon boot #240

Closed
bkuhlmann opened this issue Dec 28, 2024 · 4 comments · Fixed by #241
Closed

Fix Kernel system type error when hitting enter upon boot #240

bkuhlmann opened this issue Dec 28, 2024 · 4 comments · Fixed by #241

Comments

@bkuhlmann
Copy link

Why

Hello. 👋 I'm seeing an issue where upon initial launch of retest -- and hitting ENTER -- will cause the following exception:

Setup identified: [RSPEC]. Using command: 'bin/rspec <test>'
Watcher: [LISTEN]
Launching Retest...
Ready to refactor! You can make file changes now

Type interactive command and press enter. Enter 'h' for help.
>
Running last command: ''

/Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/gems/3.4.0/gems/retest-2.0.0/lib/retest/runner.rb:88:in 'Kernel#system': no implicit conversion of nil into String (TypeError)

      result = system(command) ? :tests_pass : :tests_fail
                      ^^^^^^^
	from /Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/gems/3.4.0/gems/retest-2.0.0/lib/retest/runner.rb:88:in 'Retest::Runner#system_run'
	from /Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/gems/3.4.0/gems/retest-2.0.0/lib/retest/runner.rb:18:in 'Retest::Runner#run_last_command'
	from /Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/3.4.0/forwardable.rb:240:in 'Retest::Program#run_last_command'
	from /Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/gems/3.4.0/gems/retest-2.0.0/exe/retest:100:in 'Object#run_command'
	from /Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/gems/3.4.0/gems/retest-2.0.0/exe/retest:136:in 'block (2 levels) in <top (required)>'
	from /Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/gems/3.4.0/gems/retest-2.0.0/exe/retest:134:in 'Array#each'
	from /Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/gems/3.4.0/gems/retest-2.0.0/exe/retest:134:in 'block in <top (required)>'
	from <internal:kernel>:168:in 'Kernel#loop'
	from /Users/bkuhlmann/.cache/frum/versions/3.4.1/lib/ruby/gems/3.4.0/gems/retest-2.0.0/exe/retest:128:in '<top (required)>'
	from /var/folders/yn/zk8yhvr1593bbyy_v77zjmg00000gn/T/frum_1678_1735397815355/bin/retest:25:in 'Kernel#load'
	from /var/folders/yn/zk8yhvr1593bbyy_v77zjmg00000gn/T/frum_1678_1735397815355/bin/retest:25:in '<main>'

How

To recreate, launch retest in any project and immediately hit ENTER to recreate the above. The workaround is to run ra from the restest command prompt to seed it with information and the problem goes away. This only happens upon initial launch.

I'm guessing you'd want to ensure the command being passed to system defaults to ra as that is the default behavior when hitting ENTER once retest is fully initialized.

Notes

  • Operating System: macOS 15.2
  • Ruby: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin24.2.0]
  • Retest: 2.0.0
@AlexB52
Copy link
Owner

AlexB52 commented Jan 2, 2025

Sorry for the late reply, I just saw that today and didn't receive an email. Not sure what's going on.

Thanks @bkuhlmann,
I can reproduce the issue and it should be an easy fix. I will push a patch once I get around it (probably before the end of next week)

@AlexB52
Copy link
Owner

AlexB52 commented Jan 4, 2025

@bkuhlmann

I've released v2.0.1

The behaviour now is to run the launching command if it does not include placeholders like <test> or <changed>. Pressing Enter when starting retest as retest --all or retest 'bin/rails test' or retest 'ruby filename.rb' will run the said command.

If retest is launched with placeholders like retest 'ruby <changed>' or retest --rails or retest 'bin/rails test <test>' , pressing Enter will print the error Error - Not enough information to run a command. Please trigger a run first.

@bkuhlmann
Copy link
Author

bkuhlmann commented Jan 4, 2025

Thanks! Ah, OK, I've been using retest to only launch but I've updated my alias to use retest --all to ensure Retest is properly seeded so I don't get the error.

@AlexB52
Copy link
Owner

AlexB52 commented Jan 4, 2025

Yup the default behaviour is to run a single matching file and the --all option should be used if you can run the whole test suite locally. Thanks for reporting the 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