@gtheys/pi-test-runner0.2.0
Pi extension — non-blocking run_tests tool that discovers and runs JS/TS tests via an isolated subagent
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-test-runner
⚠️ Experimental / Work in Progress — behaviour may change.
Pi extension that discovers and runs JS/TS test scripts from the nearest package.json, spawning an isolated subagent via pi-interactive-subagents. Results are injected back into the session automatically when done — the tool is non-blocking.
Requirements
pi-interactive-subagentsmust be installed and loaded.- A supported terminal multiplexer (cmux, tmux, zellij, wezterm, or herdr) must be available.
- Tests run in a persistent session so the subagent has a session file to switch back to.
How it works
- Scans up from the current directory to find the nearest
package.json. - Extracts scripts matching test patterns (
test,test:*,jest,vitest,playwright,mocha,cypress,e2e,spec). - If multiple scripts exist and no
scriptparam is given, shows a picker. - Detects the package manager from lockfiles (
yarn.lock,pnpm-lock.yaml, fallback tonpm). - Calls
launchSubagentfrompi-interactive-subagentsto spawn a bash-only subagent running thetest-runneragent definition. - Returns immediately — the session is unlocked while tests run.
- Watches the subagent in the background; when it exits, sends a
test_runner_resultsteer message with structured pass/fail data.
Setup
The first time you use the extension, install the bundled test-runner agent definition into the global agents directory:
/test-runner setup
This copies agents/test-runner.md to ~/.pi/agent/agents/test-runner.md so pi-interactive-subagents can resolve the test-runner agent.
Tool parameters
| Parameter | Type | Description |
|---|---|---|
script |
string? |
Script key from package.json (e.g. test:unit). Auto-detected if omitted. |
cwd |
string? |
Working directory to search. Defaults to the current project directory. |
model |
string? |
Model ID for the subagent. Overrides the configured default. |
Commands
/run-tests — run tests (non-blocking)
/run-tests test:unit — run a specific script
/test-runner setup — install the test-runner agent definition
/test-runner switch — jump into the most recent running test session
/test-runner back — return to the previous session
/test-runner model <id> — set the default subagent model
/test-runner model — show the current default model
/test-runner reset — clear all config
/test-runner status — show config and active runs
Configuration
Global config: ~/.pi/agent/test-runner/config.json
| Option | Type | Default | Description |
|---|---|---|---|
defaultModel |
string | (pi default) | Model ID for the test-runner subagent |
{
"$schema": "./.pi/agent/test-runner/config.schema.json",
"defaultModel": "claude-haiku-4-5"
}