首页/ AI 技能 / @skilllib/skill-2014279411497906178
Skill站外收录 @skilllib/skill-2014279411497906178

running-tests

自动检测项目中的测试框架并执行测试流程,捕获运行结果与失败详情,生成包含状态、统计信息和摘要的结构化检查点文件,适用于验证代码变更后的测试通过情况。

0.0 (0) 569 次安装 原作者 编程导航
收录于 2026-01-22
测试与安全 AI 技能

Skills.MD

# Test Runner Checkpoint Auto-detects test framework and runs tests, writing results to `.checkpoints/test-runner.json`. ## Workflow ``` Progress: - [ ] Step 1: Detect test framework - [ ] Step 2: Run tests with timeout - [ ] Step 3: Write checkpoint result ``` ### Step 1: Detect Test Framework | Indicator | Command | |-----------|---------| | `package.json` with test script | `npm test -- --run` (preferred), fallback `npm test` | | `pytest.ini` or `conftest.py` | `pytest --tb=short` | | `Cargo.toml` | `cargo test` | | `go.mod` | `go test ./...` | | `Makefile` with test target | `make 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 ./...`

评论 0

还没有评论,来抢沙发。