@@ -464,6 +464,7 @@ func TestHelp(t *testing.T) {
464464 cli .OverrideArgs ([]string {"--help" }),
465465 cli .RequiredArg ("src" , "The file to copy" ), // This one is required
466466 cli .OptionalArg ("dest" , "Destination to copy to" , "./dest" ), // This one is optional
467+ cli .OptionalArg ("other" , "Something else" , "" ), // This is optional but default is empty
467468 cli .Run (func (cmd * cli.Command , args []string ) error { return nil }),
468469 },
469470 wantErr : false ,
@@ -543,16 +544,17 @@ func TestHelp(t *testing.T) {
543544
544545 for _ , tt := range tests {
545546 t .Run (tt .name , func (t * testing.T ) {
546- // Force no colour in tests
547- t .Setenv ("NO_COLOR" , "true" )
548-
549547 snap := snapshot .New (t , snapshot .Update (* update ))
550548
551549 stderr := & bytes.Buffer {}
552550 stdout := & bytes.Buffer {}
553551
554552 // Test specific overrides to the options in the table
555- options := []cli.Option {cli .Stdout (stdout ), cli .Stderr (stderr )}
553+ options := []cli.Option {
554+ cli .Stdout (stdout ),
555+ cli .Stderr (stderr ),
556+ cli .NoColour (true ),
557+ }
556558
557559 cmd , err := cli .New ("test" , slices .Concat (options , tt .options )... )
558560
@@ -681,14 +683,15 @@ func TestVersion(t *testing.T) {
681683
682684 for _ , tt := range tests {
683685 t .Run (tt .name , func (t * testing.T ) {
684- // Force no colour in tests
685- t .Setenv ("NO_COLOR" , "true" )
686-
687686 stderr := & bytes.Buffer {}
688687 stdout := & bytes.Buffer {}
689688
690689 // Test specific overrides to the options in the table
691- options := []cli.Option {cli .Stdout (stdout ), cli .Stderr (stderr )}
690+ options := []cli.Option {
691+ cli .Stdout (stdout ),
692+ cli .Stderr (stderr ),
693+ cli .NoColour (true ),
694+ }
692695
693696 cmd , err := cli .New ("version-test" , slices .Concat (tt .options , options )... )
694697 test .Ok (t , err )
0 commit comments