Runs a Program as if it were ran on the command line, including middleware,
commands, success and failure states, and more. Utilizes mocked streams to capture
and return standard output and ANSI stripped output. Failed runs will not throw
and instead will render a failure output.
import{ runProgram }from'@boost/cli/test'; import Program from'../src/program'; it('runs a program',async()=>{ const program =newProgram(); const{ code, output }=awaitrunProgram(program,['cmd','--foo','123','bar']); expect(output).toMatchSnapshot(); expect(code).toBe(0); });
Runs a
Program
as if it were ran on the command line, including middleware, commands, success and failure states, and more. Utilizes mocked streams to capture and return standard output and ANSI stripped output. Failed runs will not throw and instead will render a failure output.