import { expect, tap } from '@git.zone/tstest/tapbundle'; import * as smartshell from '../ts/index.js'; tap.test('should handle passthrough for interactive commands', async () => { const testSmartshell = new smartshell.Smartshell({ executor: 'bash', sourceFilePaths: [], }); // Test with a simple echo command that doesn't need input const result = await testSmartshell.execPassthrough('echo "Testing passthrough"'); expect(result.exitCode).toEqual(0); expect(result.stdout).toContain('Testing passthrough'); }); tap.test('should handle streaming passthrough', async () => { const testSmartshell = new smartshell.Smartshell({ executor: 'bash', sourceFilePaths: [], }); // Test streaming passthrough with a simple command const streamingResult = await testSmartshell.execStreamingPassthrough('echo "Testing streaming passthrough"'); const finalResult = await streamingResult.finalPromise; expect(finalResult.exitCode).toEqual(0); expect(finalResult.stdout).toContain('Testing streaming passthrough'); }); tap.test('should allow normal exec without passthrough', async () => { const testSmartshell = new smartshell.Smartshell({ executor: 'bash', sourceFilePaths: [], }); // Regular exec should still work as before const result = await testSmartshell.exec('echo "Normal exec"'); expect(result.exitCode).toEqual(0); expect(result.stdout).toContain('Normal exec'); }); export default tap.start();