(t *testing.T, console *expect.Console, spinnerDisabled bool)
| 176 | } |
| 177 | |
| 178 | func 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 |
no test coverage detected