The global variables make running a bunch of unit tests in parallel more challenging, but if each CLI command takes in an "IO" interface with methods to read/write or make network calls then mocking, running tests in parallel, and focusing on the logic rather than environment setup would be a lot easier.
Changes
Initial example of how dispatch could run the commands while redirecting stdout / stderr to make assertions. Might be useful for this issue https://github.com/dispatchrun/dispatch/issues/58.
Potential Next Steps
The global variables make running a bunch of unit tests in parallel more challenging, but if each CLI command takes in an "IO" interface with methods to read/write or make network calls then mocking, running tests in parallel, and focusing on the logic rather than environment setup would be a lot easier.