MCPcopy Create free account
hub / github.com/cli/cli / newTestIOStreams

Function newTestIOStreams

pkg/iostreams/iostreams_progress_indicator_test.go:178–198  ·  view source on GitHub ↗
(t *testing.T, console *expect.Console, spinnerDisabled bool)

Source from the content-addressed store, hash-verified

176}
177
178func newTestIOStreams(t *testing.T, console *expect.Console, spinnerDisabled bool) *IOStreams {
179 t.Helper()
180
181 in := console.Tty()
182 out := console.Tty()
183 errOut := console.Tty()
184
185 // Because the briandowns/spinner checks os.Stdout directly,
186 // we need this hack to trick it into allowing the spinner to print...
187 os.Stdout = out
188
189 io := &IOStreams{
190 In: in,
191 Out: out,
192 ErrOut: errOut,
193 term: fakeTerm{},
194 }
195 io.progressIndicatorEnabled = true
196 io.SetSpinnerDisabled(spinnerDisabled)
197 return io
198}
199
200// failOnExpectError adds an observer that will fail the test in a standardised way
201// if any expectation on the command output fails, without requiring an explicit

Callers 1

Calls 2

SetSpinnerDisabledMethod · 0.95
HelperMethod · 0.65

Tested by

no test coverage detected