Test Runner
Execute and analyze tests for the project at $ARGUMENTS.
Supported Test Frameworks
- •Python: pytest, unittest
- •JavaScript/TypeScript: Jest, Mocha, Vitest
- •Go: go test
- •Rust: cargo test
Dynamic Context
- •Test configuration: !
find . -name "pytest.ini" -o -name "pyproject.toml" -o -name "jest.config.*" -o -name "vitest.config.*" 2>/dev/null | head -5 - •Test directories: !
find . -type d -name "test*" -o -name "__tests__" 2>/dev/null | head -5
Instructions
1. Detect Test Framework
Check for test configuration files:
- •
pytest.ini,pyproject.toml→ pytest - •
jest.config.js,package.jsonwith jest → Jest - •
vitest.config.ts→ Vitest - •
go.modwith_test.gofiles → go test
2. Run Tests
Execute the appropriate test command:
Python (pytest):
bash
python -m pytest -v --tb=short 2>&1
JavaScript (npm):
bash
npm test 2>&1
Go:
bash
go test ./... -v 2>&1
3. Analyze Results
Parse test output for:
- •Total tests run
- •Passed/Failed/Skipped counts
- •Error messages and stack traces
- •Slow tests (if timing available)
4. For Failures
For each failing test:
- •Read the test file to understand intent
- •Check the error message
- •Suggest potential fix
Output Format
Return a JSON test report:
json
{
"framework": "pytest",
"summary": {
"total": 50,
"passed": 48,
"failed": 2,
"skipped": 0,
"duration_seconds": 12.5
},
"status": "failed",
"failures": [
{
"test": "test_user_login",
"file": "tests/test_auth.py",
"line": 42,
"error_type": "AssertionError",
"message": "Expected status 200, got 401",
"suggestion": "Check if the test user credentials are valid in test fixtures"
}
],
"slow_tests": [
{
"test": "test_large_file_upload",
"duration_seconds": 5.2
}
],
"coverage": {
"percentage": 78.5,
"missing_files": ["src/utils/cache.py"]
}
}
Interpretation
- •All Passed: Great! Code is healthy
- •Some Failed: Review failures, may indicate bugs or outdated tests
- •Many Failed: Possible breaking change or environment issue
- •Slow Tests: May need optimization or mocking
Exit Codes
- •
0: All tests passed - •
1: Some tests failed - •
2: Test collection/configuration error