Skip to content
Source on GitHub (opens in a new tab)
import "github.com/barevoidco/zelk/core/testkit/testshell"

Package testshell finds native shells and synchronizes test commands with the tests that read their output.

func Path(t *testing.T, environ func() []string) string

Path returns the native Bash executable or fails the test if Windows does not have Git for Windows installed.

type OutputSignals struct {
env.Environment
// contains filtered or unexported fields
}

OutputSignals observes a test command’s stdout checkpoints on its separate stderr stream. The command writes ! to stderr after each piece of stdout the test will read.

func NewOutputSignals(e env.Environment, count int) *OutputSignals

NewOutputSignals wraps a test environment that will start one command with count stdout checkpoints.

func (s *OutputSignals) Start(ctx context.Context, cmd env.Cmd) (env.Proc, error)

Start connects the command’s stderr to its checkpoints.

func (s *OutputSignals) Wait(ctx context.Context) error

Wait waits for the next checkpoint without reading the command’s stdout.

func (s *OutputSignals) Write(p []byte) (int, error)

Write delivers checkpoint bytes without blocking the process’s stderr copier.