feat(inquirerer-test): add runCli subprocess helper + Testing docs#79
Merged
pyramation merged 1 commit intomainfrom Apr 26, 2026
Merged
feat(inquirerer-test): add runCli subprocess helper + Testing docs#79pyramation merged 1 commit intomainfrom
pyramation merged 1 commit intomainfrom
Conversation
… inquirerer Adds a runCli/parseArgString helper to @inquirerer/test for end-to-end CLI subprocess tests, alongside the existing in-process Inquirerer harness. Defaults match common Jest expectations: rejects on non-zero exit (with captured stdout/stderr/exitCode attached to RunCliError), inherits the parent env unless overridden, 30s default timeout, configurable kill signal, and an opt-out (`reject: false`) for inspecting failure cases. Also adds a Testing section to inquirerer's main README pointing at @inquirerer/test so the helper is discoverable from the consumer side.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
runClisubprocess helper to@inquirerer/testand surfaces the package frominquirerer's own README so it's actually discoverable.What's new in
@inquirerer/test(sibling to the existing in-processcreateTestEnvironment/createTestFixture):runCli(bin, args, options?)— spawn a CLI binary, capture stdout/stderr, enforce a timeout, and assert on exit code. Defaults match common Jest expectations: rejects on non-zero exit with captured streams attached toRunCliError; passreject: falseto inspect failures withouttry/catch.parseArgString(args)— split a shell-like string into an argv array (whitespace + quote-aware, no shell expansion).RunCliError— typed error withstdout/stderr/exitCode/signal/timedOut/commandfields.Why now
Hand-rolled subprocess harnesses keep showing up (
spawn+ arg-string parser + timeout + stdout/stderr capture) any time someone wants a real CLI E2E test. The in-processcreateTestEnvironmentis great for unit-testing prompts but doesn't help when the test needs the actual built executable. Now both shapes live in one package.Inquirerer README discoverability
The companion test package was effectively invisible from
inquirerer's docs — no Testing section, no link. Added a small Testing section that shows both the in-process and subprocess flows and links to the full@inquirerer/testREADME.Files
packages/inquirerer-test/src/subprocess.ts— new helperpackages/inquirerer-test/src/index.ts— re-exportsrunCli,parseArgString,RunCliError,RunCliOptions,RunCliResultpackages/inquirerer-test/__tests__/subprocess.test.ts— 14 tests coveringparseArgString(5) andrunCli(9: stdout/stderr capture, default reject behaviour, error attachment,reject: false, stdin piping, customcwd/env, timeout, spawn error)packages/inquirerer-test/README.md— new "Subprocess Testing (CLI E2E)" section + API tablepackages/inquirerer/README.md— new "Testing" section pointing at@inquirerer/testReview & Testing Checklist for Human
subprocess.tsAPI surface — happy withrunCli(bin, args, options)signature, default 30s timeout, defaultreject: true,RunCliErrorshape?env(replaces parent env when set) matches the policy you want — the alternative would be "merge with parent" but I matched Node'schild_process.spawnsemantics for least surprise.1.4.0); leaving the version at1.3.5for whoever's runninglerna version.Notes
pnpm --filter @inquirerer/test test).pnpm --filter @inquirerer/test build) — both CJS and ESM.constructive-io/constructive: drop the localtest-utilsre-export and import from@inquirerer/testdirectly.constructive-io/agentic-db: replace the hand-rolledrunCliincli-e2e-testswith this one.Link to Devin session: https://app.devin.ai/sessions/81001448b7c54b8099437f706d44a30d
Requested by: @pyramation