jorgebucaran / fishtape

100% pure-Fish test runner
MIT License
347 stars 20 forks source link

Fishtape 3 #53

Closed jorgebucaran closed 3 years ago

jorgebucaran commented 3 years ago

It's that time of the year again. The plan is to use Fish 3.0, make Fishtape faster, smaller, revise the API, and whatnot.

The biggest breaking change will be going back to running tests serially. This makes your tests behave more predictably and might even make most tests out there faster since we'd no longer block (per file), need that extra subshell, or have to handle background jobs.

Serial processing also means we don't have to preprocess test files anymore, so setup and teardown are no longer necessary. The best way to do work before and after a test is simply right there in your test file.

I also think it's a good time to remove all the magic left in Fishtape, e.g.: automatically collapsing newlines in test arguments.

Consider this (surprisingly) passing test:

@test (seq 3) = "1 2 3"

This is magic. The right way to write this is:

@test (echo (seq 3)) = "1 2 3"

# or

@test (seq 3 | string join " ") = "1 2 3"

Magic makes it more difficult to reason about your code because it violates the principle of WYSIWYG. If you want to turn (seq 3) into "1 2 3" you really need use to echo or pipe it into string join " ", which is a bit more code than before, but at least it's correct, so when things break it will be more likely your code and not Fishtape.