Method names in Higher Order Methods error messages #1255
ncphillips
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
One of the things I miss from
rspec
is the additional context they provide around test failures.How things are
Pest
Currently in Pest, I only see the value I expected and the value I received. Sometimes this is enough, but there are scenarios where the error message alone isn't really enough to understand what went wrong.
For example, if I have this test:
The only error message I receive is:
While this is technically correct, it doesn't paint a broad picture.
Screenshots
Granted, this is maybe more of a PHPStorm integeration issue. When running Pest directly via the command there is more context provided:
Rspec
Still, if we write the same test in Ruby/Rspec
Then we get quite a bit more output in Rubymine
Here we can see:
Rubymine Screenshot
Higher Order Methods
I'll highlight that this is particularly nice output for higher order methods.
Rather printing the value returned from the method, they print the name of the method that was called.
Note: this doesn't happen for regular assertions.
I wonder if this is possible with Pest, but I also wonder if we could take it further? Could we always print the name of the variable?
For example:
Would throw an error message like:
Beta Was this translation helpful? Give feedback.
All reactions