AgentSkillsCN

running-tests

指挥官门禁的测试运行检查点。检测测试框架(Jest、PyTest、Cargo Test、Go Test等),运行测试并捕获输出。返回结构化的评审结果,包含通过/未通过的状态以及未通过测试的详细信息。在以下场景中使用此功能:“运行测试”“测试运行器”“检查测试是否通过”。

SKILL.md
--- frontmatter
name: running-tests
description: "Test runner checkpoint for conductor gates. Detects test framework (jest, pytest, cargo test, go test, etc.), runs tests, and captures output. Returns structured result with pass/fail status and failed test details. Use when: 'run tests', 'test runner', 'check tests pass'."
user-invocable: true

Test Runner Checkpoint

Auto-detects test framework and runs tests, writing results to .checkpoints/test-runner.json.

Workflow

code
Progress:
- [ ] Step 1: Detect test framework
- [ ] Step 2: Run tests with timeout
- [ ] Step 3: Write checkpoint result

Step 1: Detect Test Framework

IndicatorCommand
package.json with test scriptnpm test -- --run (preferred), fallback npm test
pytest.ini or conftest.pypytest --tb=short
Cargo.tomlcargo test
go.modgo test ./...
Makefile with test targetmake test

Step 2: Run Tests

bash
timeout 300 <test-command> 2>&1 | tee /tmp/test-output.txt
TEST_EXIT_CODE=${PIPESTATUS[0]}

Step 3: Write Checkpoint Result

bash
mkdir -p .checkpoints
cat > .checkpoints/test-runner.json << 'EOF'
{
  "checkpoint": "test-runner",
  "timestamp": "...",
  "passed": true,
  "framework": "vitest",
  "command": "npm test -- --run",
  "exit_code": 0,
  "stats": {"total": 17, "passed": 17, "failed": 0},
  "failed_tests": [],
  "summary": "All 17 tests passed"
}
EOF

Decision Criteria

Pass: Exit code 0, no test failures

Fail: Any test fails, tests error out, or timeout (300s default)

No tests found: Pass with "framework": "none"

JSON Output Flags (optional)

For complex parsing, use framework JSON output:

  • Jest: npx jest --json --outputFile=/tmp/results.json
  • Pytest: pytest --json-report (requires plugin)
  • Go: go test -json ./...