tony-go / clix

Write acceptance tests easily for your CLI program.
21 stars 2 forks source link

proposal: new architecture #25

Open tony-go opened 2 years ago

tony-go commented 2 years ago

Context

Clix development is stuck at this point. Issue #16 is still a blocker as simulating keystrokes within Node.js processes doesn't seem possible (https://github.com/nodejs/node/issues/43137).

In hindsight, we probably didn't adopt the right approach.

Now I know that what We try to accomplish is to simulate the execution of the CLI program in a terminal: writing scenarios that will simulate user actions on the terminal.

Proposal

Spawn a headless terminal instead of spawning a simple process.

xterm-headless is probably a good candidate for a first POC.

I'll continue to browse the web looking for new candidates.

tony-go commented 2 years ago

Alternatives: https://github.com/vercel/hyper

tony-go commented 1 year ago

https://github.com/microsoft/node-pty

tony-go commented 1 year ago

A first good step should be to take a look at https://github.com/microsoft/node-pty, for example, and see if it's easy to spawn a command within and get the result programmatically.