@@ -687,65 +687,3 @@ info v0.30.0-beta.2`;
687687 assert . strictEqual ( result , '0.30.0-beta.2' ) ;
688688 } ) ;
689689} ) ;
690-
691- suite ( 'executeCommand' , ( ) => {
692- test ( 'should resolve when command succeeds with stdout only' , async ( ) => {
693- // Test with a simple command that only outputs to stdout
694- const result = await executeCommand ( 'echo "hello world"' ) ;
695- assert . strictEqual ( result . trim ( ) , 'hello world' ) ;
696- } ) ;
697-
698- test ( 'should resolve when command succeeds with stderr output (informational)' , async ( ) => {
699- // Test with a command that outputs to stderr but exits with code 0
700- // This simulates brew update behavior where informational messages go to stderr
701- const result = await executeCommand ( 'echo "output" && echo "info message" >&2' ) ;
702- assert . strictEqual ( result . trim ( ) , 'output' ) ;
703- } ) ;
704-
705- test ( 'should reject when command fails with non-zero exit code' , async ( ) => {
706- // Test with a command that fails (exit code 1)
707- try {
708- await executeCommand ( 'exit 1' ) ;
709- assert . fail ( 'Expected executeCommand to reject but it resolved' ) ;
710- } catch ( error ) {
711- assert . ok ( typeof error === 'string' ) ;
712- assert . ok ( error . includes ( 'exec error' ) ) ;
713- }
714- } ) ;
715-
716- test ( 'should reject when command fails and include stderr in error message' , async ( ) => {
717- // Test with a command that fails and outputs to stderr
718- try {
719- await executeCommand ( 'echo "error details" >&2 && exit 1' ) ;
720- assert . fail ( 'Expected executeCommand to reject but it resolved' ) ;
721- } catch ( error ) {
722- assert . ok ( typeof error === 'string' ) ;
723- assert . ok ( error . includes ( 'exec error' ) ) ;
724- assert . ok ( error . includes ( 'error details' ) ) ;
725- }
726- } ) ;
727-
728- test ( 'should handle command not found errors' , async ( ) => {
729- try {
730- await executeCommand ( 'nonexistentcommand12345' ) ;
731- assert . fail ( 'Expected executeCommand to reject but it resolved' ) ;
732- } catch ( error ) {
733- assert . ok ( typeof error === 'string' ) ;
734- assert . ok ( error . includes ( 'exec error' ) ) ;
735- }
736- } ) ;
737-
738- test ( 'should resolve with empty string when command succeeds with no output' , async ( ) => {
739- const result = await executeCommand ( 'true' ) ; // true command succeeds and outputs nothing
740- assert . strictEqual ( result , '' ) ;
741- } ) ;
742-
743- test ( 'should simulate brew update behavior (GitHub issue #292)' , async ( ) => {
744- // Simulate the specific case from GitHub issue #292 where brew sends
745- // informational messages to stderr but the command succeeds
746- const result = await executeCommand ( 'echo "Already up-to-date." && echo "==> Updating Homebrew..." >&2' ) ;
747-
748- // Should resolve (not reject) and return stdout content
749- assert . strictEqual ( result . trim ( ) , 'Already up-to-date.' ) ;
750- } ) ;
751- } ) ;
0 commit comments