In some cases, I’ll use AI to call out any discrepencies which is especially true for more complicated screens with lot of text.
Another alternative if you want to catch small differences is Kaleidoscope. A free alternative (for text only) is diffchecker.com
system: |
<Diff>
$input
</Diff>
You are an expert FANG engineer reviewing a pull request.
Suggest any improvements, optimizations, and keep an eye out for any bugs or things that look misplaced.
Iterate file by file, and then end your message by reviewing the entire commit together and providing commentary.
For any changes you suggest, please output the modified code or some example code.
When making suggestions, please reference the specific lines you want to change before your code block.
Pay particular attention to strings or frontend code that may contain typos, grammar mistakes, or other language problems.
When prefacing any potential mistake use this emoji to start that line:
When reviewing a file that has no issues, preface with:
Do not include any introductory message. No yapping.
I run commitmsg
before sending out a PR, which diffs and then sends the output to an LLM using the llm tool.
commitmsg='git show --no-color HEAD -- '\'':!sorbet/rbi/dsl'\'' '\'':!sorbet/rbi/gems'\'' '\'':!yarn.lock'\'' '\'':!fixtures'\'' | llm -t commitmsg'
It has caught lots of nits and issues for me before a human ever looks at it!
wspec='watchexec --stop-timeout 0 -e rb,ts,jbuilder -- bundle exec spring rspec "$@" --fail-fast'
wspec mytest_spec.rb
I use a personal .gitignore
and store a bunch of “snippets” that I’ve caught myself running in the console over and over again. Let’s say you’re debugging a function that has strange behavior - you don’t want to write tests, because you already have a repro on the console, but changing the method seems to break other cases.
# scratch.rb
passed = [
foo(a),
foo(b),
foo(c),
foo(d),
].all? { true }
puts "Passed: #{passed}"
Then I run watchexec --stop-timeout 0 -e rb -- rails runner <scratch.rb>
Now I can modify foo
over and over again and each time I hit save it’ll tell me if I fixed it. This is much faster than having to write a test case, scaffolding all the data, etc.
You can also put requests in here, via curl
and mimic what is happening on the network. Repeat the UX, copy the cURL
as below and put it in your scratch.rb file.
# scratch.rb
request_1 = `curl ...`
request_2 = `curl ...`
request_3 = `curl ...`
passed = [
foo(a),
foo(b),
foo(c),
foo(d),
].all? { true }
puts "Passed: #{passed}"
class TestUtils
def setup_some_scenario
# ...
end
end
While implementing this for a test case in the test environment is something you’ll have to do anyway, it’s often better to keep it outside of the test environment so you can run it in development.
Usually these scripts are extracted from my scratch.rb
file when it gets really big.