Skip to content

Commit 10e2833

Browse files
committed
feat: add error message for the test tool
Signed-off-by: peefy <[email protected]>
1 parent b46d2a4 commit 10e2833

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

cmd/kcl/commands/registry.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func NewRegistryCmd() *cobra.Command {
2929
Long: registryDesc,
3030
Example: registryExample,
3131
SilenceUsage: true,
32+
Aliases: []string{"reg", "r"},
3233
}
3334

3435
cmd.PersistentFlags().BoolVarP(&quiet, "quiet", "q", false, "Set the quiet mode (no output)")

cmd/kcl/commands/test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ func NewTestCmd() *cobra.Command {
5050
o.PkgList = args
5151
return test(o, runOpts)
5252
},
53-
SilenceUsage: true,
54-
Aliases: []string{"t"},
53+
SilenceErrors: true,
54+
SilenceUsage: true,
55+
Aliases: []string{"t"},
5556
}
5657

5758
flags := cmd.Flags()
@@ -89,6 +90,15 @@ func test(o *kcl.TestOptions, runOpts *options.RunOptions) error {
8990
return nil
9091
} else {
9192
reporter := testing.DefaultReporter(os.Stdout)
92-
return reporter.Report(&result)
93+
err := reporter.Report(&result)
94+
if err != nil {
95+
return err
96+
}
97+
for _, info := range result.Info {
98+
if info.ErrMessage != "" && !info.Skip() {
99+
return errors.New("")
100+
}
101+
}
102+
return nil
93103
}
94104
}

0 commit comments

Comments
 (0)