feat(cli): make --help human-readable by default
This commit is contained in:
parent
b61f27aaf3
commit
e72a99e629
3 changed files with 52 additions and 3 deletions
23
tests/cli/beadboard-help-output.test.ts
Normal file
23
tests/cli/beadboard-help-output.test.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import path from 'node:path';
|
||||
import { execFile } from 'node:child_process';
|
||||
import { promisify } from 'node:util';
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const binPath = path.resolve('bin/beadboard.js');
|
||||
|
||||
test('bb --help prints human-readable usage by default', async () => {
|
||||
const { stdout } = await execFileAsync(process.execPath, [binPath, '--help']);
|
||||
assert.match(stdout, /Usage:/i);
|
||||
assert.match(stdout, /Runtime Commands:/i);
|
||||
assert.match(stdout, /Management Commands:/i);
|
||||
assert.doesNotMatch(stdout, /^\s*\{/);
|
||||
});
|
||||
|
||||
test('bb --help --json returns structured payload', async () => {
|
||||
const { stdout } = await execFileAsync(process.execPath, [binPath, '--help', '--json']);
|
||||
const payload = JSON.parse(stdout);
|
||||
assert.equal(payload.ok, true);
|
||||
assert.equal(payload.command, 'help');
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue