
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@sebspark/cli-tester
Advanced tools
A wrapper for child_process spawn to simplify interactive cli tests using `@inquirer/prompt`
@sebspark/cli-testerA wrapper for child_process spawn to simplify interactive cli tests using @inquirer/prompt
yarn add @sebspark/cli-tester -D
npm install @sebspark/cli-tester -D
import test from 'node:test'
import assert from 'node:assert'
import { run } from '@sebspark/cli-tester'
test('awaits an input prompt and provides input', async () => {
const cli = run('./cli/input.mjs')
const prompt = await cli.prompt('input')
assert.strictEqual(prompt.type, 'input')
assert.strictEqual(prompt.message, 'type something')
assert.strictEqual(prompt.default, undefined)
await cli.input('hello')
const nextPrompt = await cli.prompt('input')
assert.strictEqual(nextPrompt.type, 'input')
assert.strictEqual(nextPrompt.message, 'type something else')
assert.strictEqual(nextPrompt.default, undefined)
})
test('awaits an input prompt with default and provides input', async () => {
const cli = run('./cli/input.mjs')
const prompt = await cli.prompt('input')
assert.strictEqual(prompt.type, 'input')
assert.strictEqual(prompt.message, 'type something')
assert.strictEqual(prompt.default, 'default value')
await cli.input('custom value')
const nextPrompt = await cli.prompt('input')
assert.strictEqual(nextPrompt.type, 'input')
assert.strictEqual(nextPrompt.message, 'type something else')
assert.strictEqual(nextPrompt.default, undefined)
})
test('awaits a select prompt and chooses an option', async () => {
const cli = run('./cli/select.mjs')
const prompt = await cli.prompt('select')
assert.strictEqual(prompt.type, 'select')
assert.strictEqual(prompt.message, 'select something')
assert.deepStrictEqual(prompt.options, ['option 1', 'option 2', 'option 3'])
await cli.select(1) // Select second option
const result = await cli.output()
assert.strictEqual(result, 'option 2')
})
test('checks CLI output after selection', async () => {
const cli = run('./cli/select.mjs')
await cli.prompt('select')
await cli.select(2)
const result = await cli.output()
assert.strictEqual(result, 'option 3')
})
test('awaits CLI exit', async () => {
const cli = run('./cli/input.mjs')
await cli.prompt('input')
await cli.input('input 1')
await cli.prompt('input')
await cli.input('input 2')
const exitCode = await cli.exit()
assert.strictEqual(exitCode, 0)
})
Add support for:
FAQs
A wrapper for child_process spawn to simplify interactive cli tests using `@inquirer/prompt`
We found that @sebspark/cli-tester demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.