tty-test-helper

Test interactive console applications

Usage no npm install needed!

<script type="module">
  import ttyTestHelper from 'https://cdn.skypack.dev/tty-test-helper';
</script>

README

npm version

tty-test-helper

Helper for testing interactive console applications.

import test from 'ava';
import ttyTestHelper from './index.js';

test('ls', async (t) => {
    const app = ttyTestHelper('ls', { args: ['fixtures'], fork: false });

    await app.next();  // waits for next stdout
    t.true(app.stdout.length === 1);
});