Repository navigation
Set up TestDriver with sample tests for the ports CLI - #4
Closed
testdriverai[bot] wants to merge 1 commit into
Closed
testdriverai[bot] wants to merge 1 commit into
testdriverai[bot] wants to merge 1 commit into
Conversation
Reviewer's GuideSets up a Vitest-based TestDriver.ai test harness and CI workflow to exercise the published Kiri Sequence diagram for GitHub Actions CI run with TestDriver.ai and Kiri ports CLIsequenceDiagram
actor Dev as Developer
participant GH as GitHubActions
participant TDAction as testdriverai_action_test
participant Vitest as npx_vitest_run
participant TDSDK as TestDriver_vitest_reporter
participant Kiri as ports_CLI
Dev->>GH: push_or_pull_request
GH->>TDAction: Authenticate_to_TestDriver(channel, api-key)
TDAction-->>GH: export_TD_API_KEY
GH->>Vitest: run_tests
Vitest->>TDSDK: initialize_TestDriver()
Vitest->>Kiri: install_@gaossr_kiri_latest
Vitest->>Kiri: run_ports_--help
Vitest->>Kiri: run_ports
Vitest->>Kiri: run_ports_ps
TDSDK-->>GH: upload_TestDriver_results
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The INSTALL script uses Bash-specific features like PIPESTATUS but runs under
sh, which may not be Bash in all environments; consider explicitly invokingbash -lcor rewriting the script to be POSIX-compliant to avoid subtle runtime issues. - The setup steps (
provision.chrome, install via INSTALL, PATH export) are repeated verbatim across all tests; factoring this into a shared helper orbeforeAll/beforeEachhook would simplify maintenance and reduce the risk of the flows diverging over time.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The INSTALL script uses Bash-specific features like PIPESTATUS but runs under `sh`, which may not be Bash in all environments; consider explicitly invoking `bash -lc` or rewriting the script to be POSIX-compliant to avoid subtle runtime issues.
- The setup steps (`provision.chrome`, install via INSTALL, PATH export) are repeated verbatim across all tests; factoring this into a shared helper or `beforeAll`/`beforeEach` hook would simplify maintenance and reduce the risk of the flows diverging over time.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Closes #3.
Sets up TestDriver in the repo and adds short sample tests for Kiri (the
portsCLI).What this app is
Kiri is a Rust-based command-line tool (
ports) for inspecting and managing local development ports — there's no web or GUI surface and no hosted "production environment" with credentials. So instead of a URL, these tests target the real production artifact: the published npm release@gaossr/kiri@latest.Each test provisions a fresh Linux sandbox, installs the released binary, runs a real
portscommand, and asserts on its actual output (ANSI colors are stripped before matching). No fixtures or credentials were needed — the sandbox's own live processes/ports provide real data for the CLI to report on.Sample tests (
tests/kiri-cli.test.mjs)--helpusage — installs the published CLI and verifies the usage banner (Kiri - inspect local listening ports,Usage:,ports --all,ports kill).portsoverview — verifies the "Kiri is watching …" banner and the table headers (Port,Process,PID,Framework,Status).ports ps— verifies the developer-process view (Kiri - running processes, and thePID/Process/Whatcolumns).Result — 3/3 passing
📊 Full test run report
installs the published CLI and prints usage via --help — ✅ passed

shows the ports overview with the Kiri banner and table headers — ✅ passed

lists developer background processes via

ports ps— ✅ passedRunning in CI
The included
.github/workflows/testdriver.ymlruns these tests. The recommended way to authenticate is the publishedtestdriverai/actionwith GitHub OIDC — it mints a short-lived token and exchanges it for your team's key at run time, so there's noTD_API_KEYsecret to store or rotate (one-time: authorize the TestDriver GitHub App for the org at https://console.testdriver.ai). A storedTD_API_KEYrepo secret is only needed as a fallback on runners without OIDC.Run locally with
npx vitest run tests/kiri-cli.test.mjs.Summary by Sourcery
Add a TestDriver-powered Vitest suite and CI workflow to validate the published Kiri
portsCLI via end-to-end CLI tests.New Features:
@gaossr/kiriCLI, covering help output, overview, and process listing commands.Build:
CI:
Tests: