@gtheys/pi-test-runner
Pi extension — non-blocking run_tests tool that discovers and runs JS/TS tests via an isolated subagent
Package details
Install @gtheys/pi-test-runner from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@gtheys/pi-test-runner- Package
@gtheys/pi-test-runner- Version
0.1.1- Published
- Jul 20, 2026
- Downloads
- 261/mo · 21/wk
- Author
- gtheys
- License
- MIT
- Types
- extension
- Size
- 30 KB
- Dependencies
- 0 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
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 to execute them. Results are injected back into the session automatically when done — the tool is non-blocking.
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). - Spawns an isolated pi subprocess as the subagent.
- Returns immediately — session is unlocked while tests run.
- Subagent sends
contact_supervisorprogress updates via pi-intercom. - When done,
pi.sendMessage({ triggerTurn: true })re-engages the LLM with structured pass/fail results.
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 current project directory. |
model |
string? |
Model ID for the subagent. Overrides the configured default. |
Commands
/run-tests — run tests, truly non-blocking
/run-tests test:unit — run a specific script
/test-runner — show current config and active runs
/test-runner model <id> — set default subagent model
/test-runner model — show current default model
/test-runner reset — clear all config
/test-runner back — return to the previous session
/run-tests vs run_tests tool
/run-tests command |
run_tests tool |
|
|---|---|---|
| Triggered by | You (directly) | LLM |
| LLM turn while running | None | One turn for "started", one for results |
| Session stays idle? | ✓ Always | ✗ LLM responds twice |
| When to use | Normal test runs | LLM-driven workflows |
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"
}