run
run copied to clipboard
testing story (e.g. mock shell environments)
Some ideas:
- encourage scripts to accept
Outputinstances, provideoutputtestpackage for building simple mocks - provide a "command factory" analogous to Buildkite's
Shell, e.g.shell.Cmd()- this factory could be an interface that facilitates mocking. Alternatively, it could beshell.Run(Runner), where*CommandimplementsRunner(now that I think of it, I like the latter):out := shell.Run(run.Cmd(ctx, "foobar")) // shell can mock execution and output, or propagate shared env
cc @jhchabran