1+ // Package test provides a testing harness and helpers for wasp-cli command tests.
12package test
23
34import (
@@ -132,7 +133,7 @@ func (h *TestHarness) RunCommand(args ...string) (string, error) {
132133 stderr := strings .TrimSpace (h .stderr .String ())
133134
134135 // Combine stdout and stderr for output
135- output := strings .TrimSpace (strings . Join ([] string { stdout , stderr }, "\n " ) )
136+ output := strings .TrimSpace (stdout + "\n " + stderr )
136137 output = strings .Trim (output , "\n " )
137138
138139 // If JSON flags are present, format output similar to production behavior
@@ -197,7 +198,9 @@ func (h *TestHarness) SetupTestConfig() {
197198
198199// CleanupTestConfig cleans up test configuration
199200func (h * TestHarness ) CleanupTestConfig () {
200- os .Unsetenv ("WASP_CLI_TEST_MODE" )
201+ if err := os .Unsetenv ("WASP_CLI_TEST_MODE" ); err != nil {
202+ require .NoError (h .t , err , "failed to unset WASP_CLI_TEST_MODE" )
203+ }
201204}
202205
203206// AssertOutputContains checks that the output contains the expected string
@@ -345,8 +348,8 @@ func (h *TestHarness) AssertPrettyJSON(output string) {
345348
346349// RunCommandWithJSON runs a command with the --json flag
347350func (h * TestHarness ) RunCommandWithJSON (args ... string ) (string , error ) {
348- jsonArgs : = append (args , "--json" )
349- return h .RunCommand (jsonArgs ... )
351+ args = append (args , "--json" )
352+ return h .RunCommand (args ... )
350353}
351354
352355// MustRunCommandWithJSON runs a command with the --json flag and requires it to succeed
@@ -358,8 +361,8 @@ func (h *TestHarness) MustRunCommandWithJSON(args ...string) string {
358361
359362// RunCommandWithJSONCompact runs a command with the --json-compact flag
360363func (h * TestHarness ) RunCommandWithJSONCompact (args ... string ) (string , error ) {
361- jsonArgs : = append (args , "--json-compact" )
362- return h .RunCommand (jsonArgs ... )
364+ args = append (args , "--json-compact" )
365+ return h .RunCommand (args ... )
363366}
364367
365368// MustRunCommandWithJSONCompact runs a command with the --json-compact flag and requires it to succeed
0 commit comments