-
Notifications
You must be signed in to change notification settings - Fork 20
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
Detect errors #60
Comments
The best we can do is an exit as soon as we encounter the first error (not failure). Did you have something else in mind? |
That sounds perfect! I don't see any reason that authors would intend for errors to appear in their tests without redirecting them to stdout so that they can be tested by fisher. 👍 |
We could lint the test file first and exit if that fails (if there are syntax errors for example), but we can't do much beyond that. |
I meant something like this: @test "echo hello if bar isn't baz" (test $bar = "baz" || echo hello) = "hello" This would error if |
I would consider this a form of magic. While arguably convenient, the true behavior of the command substitution is not immediately apparent since Fishtape can change how Fish is supposed to work. The answer is to just Wouldn't it be great if
I don't think we can completely solve this without creating a trade-off elsewhere. |
Not a full solution to #60, but it's a good start.
Could you explain this sentence further? I don't quite understand what you're saying. I am in fact suggesting some magic, but that's not a bad thing. Fishtape is a test harness, and some magic is to be expected when it helps the user catch bugs. Fishtape is lacking in magic, I think this would be a valuable addition, and I'd be happy to implement it if you're interested. If not that's okay too 😄 |
I'm interested! Maybe it's not what I'd call magic at all. You are welcome to send me a PR.
That's fine! I'd much rather avoid lock-in. I don't want users to "learn" Fishtape or write Fishtape tests. Instead, I want users to write Fish tests. Fishtape should only facilitate this. Earlier versions of Fishtape were replete with magic. I'd often find people using it in strange ways, sometimes to work around apparent bugs I'd never heard of. Simple makes your tests easier to debug because it's usually you, not Fishtape that erred.
I want to fairly guess how my test will do just by looking at the code. Magic makes this more difficult. That's all. 😁 |
Here's a more real-world example: https://github.com/IlanCosman/tide/runs/1764410359?check_suite_focus=true The pwd item produces errors on macOS that it doesn't on Linux. I'm thinking it's a seq difference perhaps, but I haven't been able to work on it yet. EDIT: Yup, it was |
I have a case in pure CI, where I run a PR's tests against Fish Fish error
I was expecting Fishtape to exit with a non-zero status code. Is there a strategy I could adopt to bubble this error to the job? |
I noticed the total number of tests is off when there is a shell error vs. when there is none. Not sure we can use the occurrence count of |
Hmm, it seems that the tests weren't counted because they didn't run. |
Got another false positive example. Looking at the github check, it seems ok But when opening the results, there is in fact failure (the variable was not set for the test)
I agree to fix is simple, but spotting the issue requires manual checks on the test output |
Did you fix the test? Please share one example of a failed test and how you fixed it. |
@jorgebucaran I declared the missing variable and added quoted on the |
source ./functions/fishtape.fish; fishtape ./tests/invalid.fish see jorgebucaran#60
source ./functions/fishtape.fish; fishtape ./tests/invalid.fish see jorgebucaran#60
source ./functions/fishtape.fish; fishtape ./tests/invalid.fish see jorgebucaran#60
Sometimes a test may pass but errors are printed to the terminal. This would be a "failure" from a human perspective. Thus, it would be nice if Fishtape could detect if errors are printed, and fail accordingly.
The text was updated successfully, but these errors were encountered: