From jaan-to
Executes test suites across JS/TS, PHP, Go stacks via npm/pnpm/yarn/phpunit/go test; diagnoses failures, auto-fixes issues, generates coverage reports for unit/integration/E2E/mutation/contract tiers.
npx claudepluginhub parhumm/jaan-to --plugin jaan-toThis skill uses the workspace's default tool permissions.
> Execute tests across stacks, diagnose failures, auto-fix simple issues, and generate coverage reports.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Execute tests across stacks, diagnose failures, auto-fix simple issues, and generate coverage reports.
$JAAN_CONTEXT_DIR/tech.md - Tech stack context (CRITICAL -- determines test runners, package manager, framework)
#current-stack, #frameworks, #constraints$JAAN_CONTEXT_DIR/config.md - Project configuration$JAAN_TEMPLATES_DIR/jaan-to-qa-test-run.template.md - Output template$JAAN_LEARN_DIR/jaan-to-qa-test-run.learn.md - Past lessons (loaded in Pre-Execution)${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.md - Language resolution protocolTest Source: $ARGUMENTS
Accepts 1-2 arguments:
/jaan-to:qa-test-generate)--unit, --integration, --e2e, --mutation, --contract, or --all (default: --all)Tier flags: --mutation runs mutation testing (StrykerJS/Infection/go-mutesting). --contract delegates API contract validation to /jaan-to:qa-contract-validate. --all includes all tiers including mutation and contract.
IMPORTANT: The input above is your starting point. Determine mode and proceed accordingly.
MANDATORY — Read and execute ALL steps in: ${CLAUDE_PLUGIN_ROOT}/docs/extending/pre-execution-protocol.md
Skill name: qa-test-run
Execute: Step 0 (Init Guard) → A (Load Lessons) → B (Resolve Template) → C (Offer Template Seeding)
Read and apply language protocol: ${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.md
Override field for this skill: language_qa-test-run
Language exception: Test execution output (command output, error messages, stack traces) is NOT affected by this setting and remains in the project's language.
ultrathink
Use extended reasoning for:
If qa-test-generate output provided:
If test directory provided:
If no input: Use AskUserQuestion:
Read $JAAN_CONTEXT_DIR/tech.md for framework detection.
| tech.md value | Test Runner | E2E Runner | Coverage Tool | Package Manager | Test Command Prefix |
|---|---|---|---|---|---|
| Node.js / TypeScript | Vitest / Jest | Playwright / Cypress | @vitest/coverage-v8 / istanbul | pnpm / npm / yarn | npx / pnpm exec |
| PHP | PHPUnit / Pest | Laravel Dusk / Codeception | PHPUnit coverage (Xdebug/PCOV) | composer | vendor/bin/ |
| Go | go test (stdlib) | Rod / Chromedp | go test -cover (built-in) | go mod | go test |
Fallback: If tech.md missing → detect from lockfiles (package-lock.json, composer.lock, go.sum) + config files (vitest.config.*, phpunit.xml, *_test.go) → AskUserQuestion if ambiguous.
Scan per detected stack:
Node.js/TypeScript:
*.test.{ts,tsx}, *.spec.{ts,tsx} in test/unit/ or __tests__/*.integration.test.*, *.int.test.* in test/integration/*.spec.{ts,tsx} in test/e2e/, e2e/, or tests/PHP:
*Test.php in tests/Unit/*Test.php in tests/Feature/*Test.php in tests/Browser/Go:
*_test.go in package directories (no build tags)*_test.go with //go:build integration tag*_test.go with //go:build e2e tagPresent file counts per tier.
Run stack-aware health checks before execution:
| Check | Node.js | PHP | Go |
|---|---|---|---|
| Dependencies installed | node_modules/ exists | vendor/ exists | go.sum exists |
| ORM client generated | Prisma: npx prisma generate | Eloquent: migrations run | sqlc: sqlc generate |
| Test env file | .env.test or .env.testing | .env.testing | _test build tag |
| E2E server | webServer config in playwright | artisan serve | custom server |
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/qa-test-run-reference.mdsection "Health Check Matrix" for per-stack detailed checks and fix commands.
If any check fails → report issue and offer auto-fix (Step 6).
Construct commands per tier based on detected stack and framework:
Node.js/TypeScript:
npx vitest run --workspace=unit --reporter=jsonnpx vitest run --workspace=integration --reporter=jsonnpx playwright test --reporter=jsonPHP:
vendor/bin/phpunit --testsuite=unit --log-junit=results.xmlvendor/bin/phpunit --testsuite=feature --log-junit=results.xmlvendor/bin/phpunit --testsuite=browser --log-junit=results.xmlGo:
go test ./... -json -covergo test ./... -json -cover -tags=integrationgo test ./... -json -tags=e2eReference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/qa-test-run-reference.mdsection "Multi-Stack Test Commands" for full command tables with flags, environment variables, and framework-specific options.
Present execution plan with estimated test counts per tier.
Show complete analysis and execution plan:
TEST EXECUTION PLAN
-------------------------------------------------------------
Stack: {detected_stack}
Test Runner: {detected_runner}
Coverage Tool: {detected_coverage}
Package Manager: {detected_pm}
Health Checks: {pass_count}/{total} passed
{list_of_checks_with_status}
Tests Found:
Unit: {count} files ({scenario_count} tests)
Integration: {count} files ({scenario_count} tests)
E2E: {count} files ({scenario_count} tests)
Execution Order: unit → integration → E2E
Tier Filter: {all|unit|integration|e2e}
{health_check_issues_if_any}
Use AskUserQuestion:
Do NOT proceed to Phase 2 without explicit approval.
Before running tests, attempt to fix common issues (stack-aware):
Node.js:
npx prisma generate.env.test from .env.examplePHP:
composer dump-autoload.env.testing from .env.examplephp artisan migrate --env=testingGo:
go generate ./...go mod tidyFor environment values (DB URLs, API keys), use AskUserQuestion to get actual values from the user -- never guess or use placeholders.
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/qa-test-run-reference.mdsection "Auto-Fix Procedures" for per-stack step-by-step procedures.
Run tests in order: unit → integration → E2E
Apply per-stack parallel execution and coverage tool selection for speed:
Parallel Execution (add flags to commands from Step 5):
| Stack | Runner | Parallel Flag | Speedup |
|---|---|---|---|
| JS/TS | Vitest | pool: 'threads' + --no-isolate (stateless tests) | ~14% faster than forks (see reference doc) |
| JS/TS | Playwright | fullyParallel: true, workers: 4, --shard=X/Y in CI | 40min → 5-7min (4 shards) |
| PHP | ParaTest | vendor/bin/paratest -p8 --runner WrapperRunner | 5x (20min → 4min) |
| Go | go test | t.Parallel() + -parallel 128 -p 16 | 3x on I/O-bound tests |
| Python | pytest-xdist | -n auto --dist loadscope | 5x with 8 cores |
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/qa-test-run-reference.mdsection "Parallel Execution Strategy" for per-stack config examples and trade-offs.
Coverage Tool Selection (prefer fast providers in CI):
| Stack | Fast Provider | Overhead | Slow Provider | Overhead |
|---|---|---|---|---|
| JS/TS | V8 (@vitest/coverage-v8) | ~10% | Istanbul | ~300% |
| PHP | PCOV | ~34% (1.3x) | Xdebug 3 | ~280% (3.8x) |
| Go | go test -cover (native) | <1-5% | N/A | N/A |
Rule: Use fast provider in CI; use slow provider locally only when branch/path coverage or debugging is needed.
E2E Auth Caching (Playwright): Use storageState to authenticate once and reuse across tests. Avoids redundant login UI flows per test.
Fail-Fast: Set maxFailures in Playwright config. If >80% of a tier fails, halt tier and diagnose before continuing (likely setup issue).
For each tier:
Important: Use --reporter=json (Vitest), --reporter=json (Playwright), --log-junit (PHPUnit), or -json (Go) for machine-parseable output. Never rely on text output parsing.
When --contract tier is selected (explicitly or via --all):
specs/openapi.yaml, specs/openapi.json, check $JAAN_OUTPUTS_DIR/backend/api-contract//jaan-to:qa-contract-validate "{contract_path}" — do NOT execute Spectral/oasdiff/Prism/Schemathesis directly (those tools are not in this skill's allowed-tools)Contract validation tools (Spectral, oasdiff, Prism, Schemathesis) are exclusively owned by
qa-contract-validate. This skill delegates rather than duplicates.
Categorize each failure into generic categories:
| Category | Auto-Fix | Examples |
|---|---|---|
| Import/Module resolution | Yes | Missing modules, wrong paths, autoload issues |
| ORM/DB client generation | Yes | Prisma not generated, Eloquent not migrated, sqlc stale |
| Environment configuration | Yes (ask value) | Missing env vars, wrong DB URLs |
| Assertion failures | No (manual) | Business logic mismatches |
| Timeout/Async errors | Suggest fix | Slow operations, missing await, goroutine leaks |
| Database/State errors | Suggest fix | Missing migrations, seed data, connection refused |
| Mock/Fixture errors | Suggest fix | Stale snapshots, missing handlers, mock mismatches |
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/qa-test-run-reference.mdsection "Error Pattern Detection" for per-stack regex patterns to identify each category.
For auto-fixable categories: apply fix and mark for re-run. For manual categories: collect diagnostic info for the report.
After auto-fixes, selectively re-run only failed tests:
Node.js (Vitest): npx vitest run --reporter=json {failed_test_files}
Node.js (Playwright): npx playwright test --reporter=json {failed_spec_files}
PHP (PHPUnit): vendor/bin/phpunit --filter="{FailedTestName}"
Go: go test -json -run "TestName" ./package/...
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/qa-test-run-reference.mdsection "Selective Re-Run Commands" for per-framework re-run flags and options.
Track which tests were fixed by auto-fix vs still failing.
Parse coverage output per stack:
Node.js: Istanbul/v8 JSON from coverage/coverage-summary.json
PHP: PHPUnit Clover XML from coverage.xml or build/logs/clover.xml
Go: go test -coverprofile=coverage.out → parse with go tool cover
Extract:
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/qa-test-run-reference.mdsection "Coverage Parsing Rules" for per-stack parsing patterns and output formats.
If --mutation tier selected OR mutation tool config detected (stryker.config.*, infection.json5, etc.):
Parse mutation score from mutation tool outputs only (never conflate with code coverage):
reports/mutation/mutation.json -> mutationScoreinfection-log.json -> stats.msikilled/total ratio (NOT go test -cover)mutmut results CLI output -> parse survived/killed/total counts (NOT .mutmut-cache SQLite)If mutation tool not available for stack: report mutation_score: null (JSON null, NOT "N/A") and exclude from quality-gate weighting. Parsers treat null as "not measured", 0 as "measured zero".
Add mutation results to output report:
Track RED-GREEN cycle count during test execution:
Compile results into structured report:
source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/id-generator.sh"
SUBDOMAIN_DIR="$JAAN_OUTPUTS_DIR/qa/test-run"
mkdir -p "$SUBDOMAIN_DIR"
NEXT_ID=$(generate_next_id "$SUBDOMAIN_DIR")
Generate slug from test directory or project name (lowercase-kebab-case, max 50 chars).
Test execution for {project_name}: {total_tests} tests across {tier_count} tiers.
{pass_count} passed, {fail_count} failed, {skip_count} skipped.
{auto_fix_count} failures auto-fixed. Coverage: {line_pct}% line, {branch_pct}% branch.
OUTPUT PREVIEW
-------------------------------------------------------------
ID: {NEXT_ID}
Folder: $JAAN_OUTPUTS_DIR/qa/test-run/{NEXT_ID}-{slug}/
Results:
Unit: {pass}/{total} passed ({coverage}% coverage)
Integration: {pass}/{total} passed ({coverage}% coverage)
E2E: {pass}/{total} passed
Auto-Fixes Applied: {count}
Remaining Failures: {count}
Use AskUserQuestion:
If approved:
OUTPUT_FOLDER="$JAAN_OUTPUTS_DIR/qa/test-run/${NEXT_ID}-${slug}"
mkdir -p "$OUTPUT_FOLDER"
Path: $OUTPUT_FOLDER/${NEXT_ID}-${slug}.md
Use template from: $JAAN_TEMPLATES_DIR/jaan-to-qa-test-run.template.md
Fill sections:
source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/index-updater.sh"
add_to_index \
"$SUBDOMAIN_DIR/README.md" \
"$NEXT_ID" \
"${NEXT_ID}-${slug}" \
"{Project Name} Test Execution" \
"{Executive Summary}"
TEST EXECUTION COMPLETE
-------------------------------------------------------------
ID: {NEXT_ID}
Folder: $JAAN_OUTPUTS_DIR/qa/test-run/{NEXT_ID}-{slug}/
Index: Updated $JAAN_OUTPUTS_DIR/qa/test-run/README.md
Results:
Total: {total_tests} tests
Passed: {pass_count}
Failed: {fail_count}
Skipped: {skip_count}
Auto-Fixed: {auto_fix_count}
Coverage:
Line: {line_pct}%
Branch: {branch_pct}%
Test execution complete!
Next Steps:
- Review failure diagnostics in the report
- Fix remaining assertion failures manually
- Re-run with
/jaan-to:qa-test-run {output-path} --allafter fixes- Use
/jaan-to:qa-test-generateto generate tests for uncovered areas- See the report for detailed coverage gaps and suggested improvements
Use AskUserQuestion:
If "Learn from this": Run /jaan-to:learn-add qa-test-run "{feedback}"
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/qa-test-run-reference.mdsection "Key Execution Rules" for test execution best practices, tier ordering rationale, and anti-patterns to avoid.
tech.md detection$JAAN_OUTPUTS_DIR path$JAAN_OUTPUTS_DIR/qa/test-run/{id}-{slug}/