running-tests

Executes Bun test suites safely with scope guards, per-file isolation loops, and failure classification.

Updated May 31, 2026
One-click install
npx skills add https://github.com/AlexanderNarbaev/agi --skill running-tests-alexandernarbaev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: running-tests
Source: https://github.com/AlexanderNarbaev/agi/tree/main/.opencode/skills/running-tests
Command: npx skills add https://github.com/AlexanderNarbaev/agi --skill running-tests-alexandernarbaev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Running tests at scale can hang or kill an AI coding session when test discovery fans out across too many files, and truncated output or misclassified failures waste debugging time. This Skill provides safe execution patterns for the test_runner tool and bun shell commands so test runs stay bounded, reproducible, and diagnosable. ## Core Features & Use Cases - Scope Safety Guards: Enforces single-source-file limits and a 50-file fan-out budget for test_runner scopes (convention, graph, impact), returning scope_exceeded instead of blocking the session. - Per-File Isolation Loops: Provides bash and PowerShell loops that run one bun --smol process per test file, matching CI behavior for mock-heavy directories like tests/unit/agents and tests/unit/tools. - Failure Classification & Verification: Distinguishes stale assertions, soft regressions, genuine pre-existing failures, and new regressions, with git worktree commands to verify failures against main. - Use Case: After changing several source files, loop over the affected test directories with per-file bun commands, capture output to a file to avoid truncation, then classify any failures before documenting them in the PR body. ## Quick Start Ask the agent to run the tests for the files you changed using per-file bun commands and classify any failures it finds.

Frequently Asked Questions about running-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run tests for multiple changed files without hanging the session?

Use a shell loop that runs bun --smol test per file instead of passing multiple files to test_runner. Multi-file calls to graph, impact, or convention scopes are rejected with scope_exceeded before fan-out begins.

When should I use test_runner vs bun shell commands?

Use test_runner only with a single source file for graph or impact discovery. Use bun shell commands for multiple files, whole directories, or full-repo validation, since test_runner scope 'all' is reserved for CI mirroring.

Why does test_runner return scope_exceeded?

scope_exceeded fires when more than one source file is passed or when the estimated fan-out exceeds 50 test files. It is a protective guard that prevents unbounded graph traversal from blocking the session.

How do I verify a test failure is pre-existing and not caused by my changes?

Create a throwaway checkout with git worktree add pointing at origin/main, run the failing test there, then remove the worktree. If it fails on main too, document it as pre-existing in the PR body.

Why do tree-sitter tests time out and how do I fix it?

Tree-sitter tests are slow on first WASM grammar load in each process. Use --timeout 60000 instead of 30000, and run the file directly with a longer timeout to distinguish WASM load delay from a genuine code failure.

How do I avoid truncated bun test output in PowerShell?

Pipe output to a file with Out-File, then read the tail with Get-Content and Select-Object -Last 50. This prevents losing output when the shell buffer is exceeded.