claude-autopm 2.8.2 → 2.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +399 -637
- package/package.json +2 -1
- package/packages/plugin-ai/LICENSE +21 -0
- package/packages/plugin-ai/README.md +316 -0
- package/packages/plugin-ai/agents/anthropic-claude-expert.md +579 -0
- package/packages/plugin-ai/agents/azure-openai-expert.md +1411 -0
- package/packages/plugin-ai/agents/gemini-api-expert.md +880 -0
- package/packages/plugin-ai/agents/google-a2a-expert.md +1445 -0
- package/packages/plugin-ai/agents/huggingface-expert.md +2131 -0
- package/packages/plugin-ai/agents/langchain-expert.md +1427 -0
- package/packages/plugin-ai/agents/langgraph-workflow-expert.md +520 -0
- package/packages/plugin-ai/agents/openai-python-expert.md +1087 -0
- package/packages/plugin-ai/commands/a2a-setup.md +886 -0
- package/packages/plugin-ai/commands/ai-model-deployment.md +481 -0
- package/packages/plugin-ai/commands/anthropic-optimize.md +793 -0
- package/packages/plugin-ai/commands/huggingface-deploy.md +789 -0
- package/packages/plugin-ai/commands/langchain-optimize.md +807 -0
- package/packages/plugin-ai/commands/llm-optimize.md +348 -0
- package/packages/plugin-ai/commands/openai-optimize.md +863 -0
- package/packages/plugin-ai/commands/rag-optimize.md +841 -0
- package/packages/plugin-ai/commands/rag-setup-scaffold.md +382 -0
- package/packages/plugin-ai/package.json +66 -0
- package/packages/plugin-ai/plugin.json +519 -0
- package/packages/plugin-ai/rules/ai-model-standards.md +449 -0
- package/packages/plugin-ai/rules/prompt-engineering-standards.md +509 -0
- package/packages/plugin-ai/scripts/examples/huggingface-inference-example.py +145 -0
- package/packages/plugin-ai/scripts/examples/langchain-rag-example.py +366 -0
- package/packages/plugin-ai/scripts/examples/mlflow-tracking-example.py +224 -0
- package/packages/plugin-ai/scripts/examples/openai-chat-example.py +425 -0
- package/packages/plugin-cloud/README.md +268 -0
- package/packages/plugin-cloud/agents/README.md +55 -0
- package/packages/plugin-cloud/agents/aws-cloud-architect.md +521 -0
- package/packages/plugin-cloud/agents/azure-cloud-architect.md +436 -0
- package/packages/plugin-cloud/agents/gcp-cloud-architect.md +385 -0
- package/packages/plugin-cloud/agents/gcp-cloud-functions-engineer.md +306 -0
- package/packages/plugin-cloud/agents/gemini-api-expert.md +880 -0
- package/packages/plugin-cloud/agents/kubernetes-orchestrator.md +566 -0
- package/packages/plugin-cloud/agents/openai-python-expert.md +1087 -0
- package/packages/plugin-cloud/agents/terraform-infrastructure-expert.md +454 -0
- package/packages/plugin-cloud/commands/cloud-cost-optimize.md +243 -0
- package/packages/plugin-cloud/commands/cloud-validate.md +196 -0
- package/packages/plugin-cloud/commands/infra-deploy.md +38 -0
- package/packages/plugin-cloud/commands/k8s-deploy.md +37 -0
- package/packages/plugin-cloud/commands/ssh-security.md +65 -0
- package/packages/plugin-cloud/commands/traefik-setup.md +65 -0
- package/packages/plugin-cloud/hooks/pre-cloud-deploy.js +456 -0
- package/packages/plugin-cloud/package.json +64 -0
- package/packages/plugin-cloud/plugin.json +338 -0
- package/packages/plugin-cloud/rules/cloud-security-compliance.md +313 -0
- package/packages/plugin-cloud/rules/infrastructure-pipeline.md +128 -0
- package/packages/plugin-cloud/scripts/examples/aws-validate.sh +30 -0
- package/packages/plugin-cloud/scripts/examples/azure-setup.sh +33 -0
- package/packages/plugin-cloud/scripts/examples/gcp-setup.sh +39 -0
- package/packages/plugin-cloud/scripts/examples/k8s-validate.sh +40 -0
- package/packages/plugin-cloud/scripts/examples/terraform-init.sh +26 -0
- package/packages/plugin-core/README.md +274 -0
- package/packages/plugin-core/agents/core/agent-manager.md +296 -0
- package/packages/plugin-core/agents/core/code-analyzer.md +131 -0
- package/packages/plugin-core/agents/core/file-analyzer.md +162 -0
- package/packages/plugin-core/agents/core/test-runner.md +200 -0
- package/packages/plugin-core/commands/code-rabbit.md +128 -0
- package/packages/plugin-core/commands/prompt.md +9 -0
- package/packages/plugin-core/commands/re-init.md +9 -0
- package/packages/plugin-core/hooks/context7-reminder.md +29 -0
- package/packages/plugin-core/hooks/enforce-agents.js +125 -0
- package/packages/plugin-core/hooks/enforce-agents.sh +35 -0
- package/packages/plugin-core/hooks/pre-agent-context7.js +224 -0
- package/packages/plugin-core/hooks/pre-command-context7.js +229 -0
- package/packages/plugin-core/hooks/strict-enforce-agents.sh +39 -0
- package/packages/plugin-core/hooks/test-hook.sh +21 -0
- package/packages/plugin-core/hooks/unified-context7-enforcement.sh +38 -0
- package/packages/plugin-core/package.json +45 -0
- package/packages/plugin-core/plugin.json +387 -0
- package/packages/plugin-core/rules/agent-coordination.md +549 -0
- package/packages/plugin-core/rules/agent-mandatory.md +170 -0
- package/packages/plugin-core/rules/ai-integration-patterns.md +219 -0
- package/packages/plugin-core/rules/command-pipelines.md +208 -0
- package/packages/plugin-core/rules/context-optimization.md +176 -0
- package/packages/plugin-core/rules/context7-enforcement.md +327 -0
- package/packages/plugin-core/rules/datetime.md +122 -0
- package/packages/plugin-core/rules/definition-of-done.md +272 -0
- package/packages/plugin-core/rules/development-environments.md +19 -0
- package/packages/plugin-core/rules/development-workflow.md +198 -0
- package/packages/plugin-core/rules/framework-path-rules.md +180 -0
- package/packages/plugin-core/rules/frontmatter-operations.md +64 -0
- package/packages/plugin-core/rules/git-strategy.md +237 -0
- package/packages/plugin-core/rules/golden-rules.md +181 -0
- package/packages/plugin-core/rules/naming-conventions.md +111 -0
- package/packages/plugin-core/rules/no-pr-workflow.md +183 -0
- package/packages/plugin-core/rules/performance-guidelines.md +403 -0
- package/packages/plugin-core/rules/pipeline-mandatory.md +109 -0
- package/packages/plugin-core/rules/security-checklist.md +318 -0
- package/packages/plugin-core/rules/standard-patterns.md +197 -0
- package/packages/plugin-core/rules/strip-frontmatter.md +85 -0
- package/packages/plugin-core/rules/tdd.enforcement.md +103 -0
- package/packages/plugin-core/rules/use-ast-grep.md +113 -0
- package/packages/plugin-core/scripts/lib/datetime-utils.sh +254 -0
- package/packages/plugin-core/scripts/lib/frontmatter-utils.sh +294 -0
- package/packages/plugin-core/scripts/lib/github-utils.sh +221 -0
- package/packages/plugin-core/scripts/lib/logging-utils.sh +199 -0
- package/packages/plugin-core/scripts/lib/validation-utils.sh +339 -0
- package/packages/plugin-core/scripts/mcp/add.sh +7 -0
- package/packages/plugin-core/scripts/mcp/disable.sh +12 -0
- package/packages/plugin-core/scripts/mcp/enable.sh +12 -0
- package/packages/plugin-core/scripts/mcp/list.sh +7 -0
- package/packages/plugin-core/scripts/mcp/sync.sh +8 -0
- package/packages/plugin-data/README.md +315 -0
- package/packages/plugin-data/agents/airflow-orchestration-expert.md +158 -0
- package/packages/plugin-data/agents/kedro-pipeline-expert.md +304 -0
- package/packages/plugin-data/agents/langgraph-workflow-expert.md +530 -0
- package/packages/plugin-data/commands/airflow-dag-scaffold.md +413 -0
- package/packages/plugin-data/commands/kafka-pipeline-scaffold.md +503 -0
- package/packages/plugin-data/package.json +66 -0
- package/packages/plugin-data/plugin.json +294 -0
- package/packages/plugin-data/rules/data-quality-standards.md +373 -0
- package/packages/plugin-data/rules/etl-pipeline-standards.md +255 -0
- package/packages/plugin-data/scripts/examples/airflow-dag-example.py +245 -0
- package/packages/plugin-data/scripts/examples/dbt-transform-example.sql +238 -0
- package/packages/plugin-data/scripts/examples/kafka-streaming-example.py +257 -0
- package/packages/plugin-data/scripts/examples/pandas-etl-example.py +332 -0
- package/packages/plugin-databases/README.md +330 -0
- package/packages/plugin-databases/agents/README.md +50 -0
- package/packages/plugin-databases/agents/bigquery-expert.md +401 -0
- package/packages/plugin-databases/agents/cosmosdb-expert.md +375 -0
- package/packages/plugin-databases/agents/mongodb-expert.md +407 -0
- package/packages/plugin-databases/agents/postgresql-expert.md +329 -0
- package/packages/plugin-databases/agents/redis-expert.md +74 -0
- package/packages/plugin-databases/commands/db-optimize.md +612 -0
- package/packages/plugin-databases/package.json +60 -0
- package/packages/plugin-databases/plugin.json +237 -0
- package/packages/plugin-databases/rules/database-management-strategy.md +146 -0
- package/packages/plugin-databases/rules/database-pipeline.md +316 -0
- package/packages/plugin-databases/scripts/examples/bigquery-cost-analyze.sh +160 -0
- package/packages/plugin-databases/scripts/examples/cosmosdb-ru-optimize.sh +163 -0
- package/packages/plugin-databases/scripts/examples/mongodb-shard-check.sh +120 -0
- package/packages/plugin-databases/scripts/examples/postgres-index-analyze.sh +95 -0
- package/packages/plugin-databases/scripts/examples/redis-cache-stats.sh +121 -0
- package/packages/plugin-devops/README.md +367 -0
- package/packages/plugin-devops/agents/README.md +52 -0
- package/packages/plugin-devops/agents/azure-devops-specialist.md +308 -0
- package/packages/plugin-devops/agents/docker-containerization-expert.md +298 -0
- package/packages/plugin-devops/agents/github-operations-specialist.md +335 -0
- package/packages/plugin-devops/agents/mcp-context-manager.md +319 -0
- package/packages/plugin-devops/agents/observability-engineer.md +574 -0
- package/packages/plugin-devops/agents/ssh-operations-expert.md +1093 -0
- package/packages/plugin-devops/agents/traefik-proxy-expert.md +444 -0
- package/packages/plugin-devops/commands/ci-pipeline-create.md +581 -0
- package/packages/plugin-devops/commands/docker-optimize.md +493 -0
- package/packages/plugin-devops/commands/workflow-create.md +42 -0
- package/packages/plugin-devops/hooks/pre-docker-build.js +472 -0
- package/packages/plugin-devops/package.json +61 -0
- package/packages/plugin-devops/plugin.json +302 -0
- package/packages/plugin-devops/rules/ci-cd-kubernetes-strategy.md +25 -0
- package/packages/plugin-devops/rules/devops-troubleshooting-playbook.md +450 -0
- package/packages/plugin-devops/rules/docker-first-development.md +404 -0
- package/packages/plugin-devops/rules/github-operations.md +92 -0
- package/packages/plugin-devops/scripts/examples/docker-build-multistage.sh +43 -0
- package/packages/plugin-devops/scripts/examples/docker-compose-validate.sh +74 -0
- package/packages/plugin-devops/scripts/examples/github-workflow-validate.sh +48 -0
- package/packages/plugin-devops/scripts/examples/prometheus-health-check.sh +58 -0
- package/packages/plugin-devops/scripts/examples/ssh-key-setup.sh +74 -0
- package/packages/plugin-frameworks/README.md +309 -0
- package/packages/plugin-frameworks/agents/README.md +64 -0
- package/packages/plugin-frameworks/agents/e2e-test-engineer.md +579 -0
- package/packages/plugin-frameworks/agents/nats-messaging-expert.md +254 -0
- package/packages/plugin-frameworks/agents/react-frontend-engineer.md +393 -0
- package/packages/plugin-frameworks/agents/react-ui-expert.md +226 -0
- package/packages/plugin-frameworks/agents/tailwindcss-expert.md +1021 -0
- package/packages/plugin-frameworks/agents/ux-design-expert.md +244 -0
- package/packages/plugin-frameworks/commands/app-scaffold.md +50 -0
- package/packages/plugin-frameworks/commands/nextjs-optimize.md +692 -0
- package/packages/plugin-frameworks/commands/react-optimize.md +583 -0
- package/packages/plugin-frameworks/commands/tailwind-system.md +64 -0
- package/packages/plugin-frameworks/package.json +59 -0
- package/packages/plugin-frameworks/plugin.json +224 -0
- package/packages/plugin-frameworks/rules/performance-guidelines.md +403 -0
- package/packages/plugin-frameworks/rules/ui-development-standards.md +281 -0
- package/packages/plugin-frameworks/rules/ui-framework-rules.md +151 -0
- package/packages/plugin-frameworks/scripts/examples/react-component-perf.sh +34 -0
- package/packages/plugin-frameworks/scripts/examples/tailwind-optimize.sh +44 -0
- package/packages/plugin-frameworks/scripts/examples/vue-composition-check.sh +41 -0
- package/packages/plugin-languages/README.md +333 -0
- package/packages/plugin-languages/agents/README.md +50 -0
- package/packages/plugin-languages/agents/bash-scripting-expert.md +541 -0
- package/packages/plugin-languages/agents/javascript-frontend-engineer.md +197 -0
- package/packages/plugin-languages/agents/nodejs-backend-engineer.md +226 -0
- package/packages/plugin-languages/agents/python-backend-engineer.md +214 -0
- package/packages/plugin-languages/agents/python-backend-expert.md +289 -0
- package/packages/plugin-languages/commands/javascript-optimize.md +636 -0
- package/packages/plugin-languages/commands/nodejs-api-scaffold.md +341 -0
- package/packages/plugin-languages/commands/nodejs-optimize.md +689 -0
- package/packages/plugin-languages/commands/python-api-scaffold.md +261 -0
- package/packages/plugin-languages/commands/python-optimize.md +593 -0
- package/packages/plugin-languages/package.json +65 -0
- package/packages/plugin-languages/plugin.json +265 -0
- package/packages/plugin-languages/rules/code-quality-standards.md +496 -0
- package/packages/plugin-languages/rules/testing-standards.md +768 -0
- package/packages/plugin-languages/scripts/examples/bash-production-script.sh +520 -0
- package/packages/plugin-languages/scripts/examples/javascript-es6-patterns.js +291 -0
- package/packages/plugin-languages/scripts/examples/nodejs-async-iteration.js +360 -0
- package/packages/plugin-languages/scripts/examples/python-async-patterns.py +289 -0
- package/packages/plugin-languages/scripts/examples/typescript-patterns.ts +432 -0
- package/packages/plugin-ml/README.md +430 -0
- package/packages/plugin-ml/agents/automl-expert.md +326 -0
- package/packages/plugin-ml/agents/computer-vision-expert.md +550 -0
- package/packages/plugin-ml/agents/gradient-boosting-expert.md +455 -0
- package/packages/plugin-ml/agents/neural-network-architect.md +1228 -0
- package/packages/plugin-ml/agents/nlp-transformer-expert.md +584 -0
- package/packages/plugin-ml/agents/pytorch-expert.md +412 -0
- package/packages/plugin-ml/agents/reinforcement-learning-expert.md +2088 -0
- package/packages/plugin-ml/agents/scikit-learn-expert.md +228 -0
- package/packages/plugin-ml/agents/tensorflow-keras-expert.md +509 -0
- package/packages/plugin-ml/agents/time-series-expert.md +303 -0
- package/packages/plugin-ml/commands/ml-automl.md +572 -0
- package/packages/plugin-ml/commands/ml-train-optimize.md +657 -0
- package/packages/plugin-ml/package.json +52 -0
- package/packages/plugin-ml/plugin.json +338 -0
- package/packages/plugin-pm/README.md +368 -0
- package/packages/plugin-pm/claudeautopm-plugin-pm-2.0.0.tgz +0 -0
- package/packages/plugin-pm/commands/azure/COMMANDS.md +107 -0
- package/packages/plugin-pm/commands/azure/COMMAND_MAPPING.md +252 -0
- package/packages/plugin-pm/commands/azure/INTEGRATION_FIX.md +103 -0
- package/packages/plugin-pm/commands/azure/README.md +246 -0
- package/packages/plugin-pm/commands/azure/active-work.md +198 -0
- package/packages/plugin-pm/commands/azure/aliases.md +143 -0
- package/packages/plugin-pm/commands/azure/blocked-items.md +287 -0
- package/packages/plugin-pm/commands/azure/clean.md +93 -0
- package/packages/plugin-pm/commands/azure/docs-query.md +48 -0
- package/packages/plugin-pm/commands/azure/feature-decompose.md +380 -0
- package/packages/plugin-pm/commands/azure/feature-list.md +61 -0
- package/packages/plugin-pm/commands/azure/feature-new.md +115 -0
- package/packages/plugin-pm/commands/azure/feature-show.md +205 -0
- package/packages/plugin-pm/commands/azure/feature-start.md +130 -0
- package/packages/plugin-pm/commands/azure/fix-integration-example.md +93 -0
- package/packages/plugin-pm/commands/azure/help.md +150 -0
- package/packages/plugin-pm/commands/azure/import-us.md +269 -0
- package/packages/plugin-pm/commands/azure/init.md +211 -0
- package/packages/plugin-pm/commands/azure/next-task.md +262 -0
- package/packages/plugin-pm/commands/azure/search.md +160 -0
- package/packages/plugin-pm/commands/azure/sprint-status.md +235 -0
- package/packages/plugin-pm/commands/azure/standup.md +260 -0
- package/packages/plugin-pm/commands/azure/sync-all.md +99 -0
- package/packages/plugin-pm/commands/azure/task-analyze.md +186 -0
- package/packages/plugin-pm/commands/azure/task-close.md +329 -0
- package/packages/plugin-pm/commands/azure/task-edit.md +145 -0
- package/packages/plugin-pm/commands/azure/task-list.md +263 -0
- package/packages/plugin-pm/commands/azure/task-new.md +84 -0
- package/packages/plugin-pm/commands/azure/task-reopen.md +79 -0
- package/packages/plugin-pm/commands/azure/task-show.md +126 -0
- package/packages/plugin-pm/commands/azure/task-start.md +301 -0
- package/packages/plugin-pm/commands/azure/task-status.md +65 -0
- package/packages/plugin-pm/commands/azure/task-sync.md +67 -0
- package/packages/plugin-pm/commands/azure/us-edit.md +164 -0
- package/packages/plugin-pm/commands/azure/us-list.md +202 -0
- package/packages/plugin-pm/commands/azure/us-new.md +265 -0
- package/packages/plugin-pm/commands/azure/us-parse.md +253 -0
- package/packages/plugin-pm/commands/azure/us-show.md +188 -0
- package/packages/plugin-pm/commands/azure/us-status.md +320 -0
- package/packages/plugin-pm/commands/azure/validate.md +86 -0
- package/packages/plugin-pm/commands/azure/work-item-sync.md +47 -0
- package/packages/plugin-pm/commands/blocked.md +28 -0
- package/packages/plugin-pm/commands/clean.md +119 -0
- package/packages/plugin-pm/commands/context-create.md +136 -0
- package/packages/plugin-pm/commands/context-prime.md +170 -0
- package/packages/plugin-pm/commands/context-update.md +292 -0
- package/packages/plugin-pm/commands/context.md +28 -0
- package/packages/plugin-pm/commands/epic-close.md +86 -0
- package/packages/plugin-pm/commands/epic-decompose.md +370 -0
- package/packages/plugin-pm/commands/epic-edit.md +83 -0
- package/packages/plugin-pm/commands/epic-list.md +30 -0
- package/packages/plugin-pm/commands/epic-merge.md +222 -0
- package/packages/plugin-pm/commands/epic-oneshot.md +119 -0
- package/packages/plugin-pm/commands/epic-refresh.md +119 -0
- package/packages/plugin-pm/commands/epic-show.md +28 -0
- package/packages/plugin-pm/commands/epic-split.md +120 -0
- package/packages/plugin-pm/commands/epic-start.md +195 -0
- package/packages/plugin-pm/commands/epic-status.md +28 -0
- package/packages/plugin-pm/commands/epic-sync-modular.md +338 -0
- package/packages/plugin-pm/commands/epic-sync-original.md +473 -0
- package/packages/plugin-pm/commands/epic-sync.md +486 -0
- package/packages/plugin-pm/commands/github/workflow-create.md +42 -0
- package/packages/plugin-pm/commands/help.md +28 -0
- package/packages/plugin-pm/commands/import.md +115 -0
- package/packages/plugin-pm/commands/in-progress.md +28 -0
- package/packages/plugin-pm/commands/init.md +28 -0
- package/packages/plugin-pm/commands/issue-analyze.md +202 -0
- package/packages/plugin-pm/commands/issue-close.md +119 -0
- package/packages/plugin-pm/commands/issue-edit.md +93 -0
- package/packages/plugin-pm/commands/issue-reopen.md +87 -0
- package/packages/plugin-pm/commands/issue-show.md +41 -0
- package/packages/plugin-pm/commands/issue-start.md +234 -0
- package/packages/plugin-pm/commands/issue-status.md +95 -0
- package/packages/plugin-pm/commands/issue-sync.md +411 -0
- package/packages/plugin-pm/commands/next.md +28 -0
- package/packages/plugin-pm/commands/prd-edit.md +82 -0
- package/packages/plugin-pm/commands/prd-list.md +28 -0
- package/packages/plugin-pm/commands/prd-new.md +55 -0
- package/packages/plugin-pm/commands/prd-parse.md +42 -0
- package/packages/plugin-pm/commands/prd-status.md +28 -0
- package/packages/plugin-pm/commands/search.md +28 -0
- package/packages/plugin-pm/commands/standup.md +28 -0
- package/packages/plugin-pm/commands/status.md +28 -0
- package/packages/plugin-pm/commands/sync.md +99 -0
- package/packages/plugin-pm/commands/test-reference-update.md +151 -0
- package/packages/plugin-pm/commands/validate.md +28 -0
- package/packages/plugin-pm/commands/what-next.md +28 -0
- package/packages/plugin-pm/package.json +57 -0
- package/packages/plugin-pm/plugin.json +503 -0
- package/packages/plugin-pm/scripts/pm/analytics.js +425 -0
- package/packages/plugin-pm/scripts/pm/blocked.js +164 -0
- package/packages/plugin-pm/scripts/pm/blocked.sh +78 -0
- package/packages/plugin-pm/scripts/pm/clean.js +464 -0
- package/packages/plugin-pm/scripts/pm/context-create.js +216 -0
- package/packages/plugin-pm/scripts/pm/context-prime.js +335 -0
- package/packages/plugin-pm/scripts/pm/context-update.js +344 -0
- package/packages/plugin-pm/scripts/pm/context.js +338 -0
- package/packages/plugin-pm/scripts/pm/epic-close.js +347 -0
- package/packages/plugin-pm/scripts/pm/epic-edit.js +382 -0
- package/packages/plugin-pm/scripts/pm/epic-list.js +273 -0
- package/packages/plugin-pm/scripts/pm/epic-list.sh +109 -0
- package/packages/plugin-pm/scripts/pm/epic-show.js +291 -0
- package/packages/plugin-pm/scripts/pm/epic-show.sh +105 -0
- package/packages/plugin-pm/scripts/pm/epic-split.js +522 -0
- package/packages/plugin-pm/scripts/pm/epic-start/epic-start.js +183 -0
- package/packages/plugin-pm/scripts/pm/epic-start/epic-start.sh +94 -0
- package/packages/plugin-pm/scripts/pm/epic-status.js +291 -0
- package/packages/plugin-pm/scripts/pm/epic-status.sh +104 -0
- package/packages/plugin-pm/scripts/pm/epic-sync/README.md +208 -0
- package/packages/plugin-pm/scripts/pm/epic-sync/create-epic-issue.sh +77 -0
- package/packages/plugin-pm/scripts/pm/epic-sync/create-task-issues.sh +86 -0
- package/packages/plugin-pm/scripts/pm/epic-sync/update-epic-file.sh +79 -0
- package/packages/plugin-pm/scripts/pm/epic-sync/update-references.sh +89 -0
- package/packages/plugin-pm/scripts/pm/epic-sync.sh +137 -0
- package/packages/plugin-pm/scripts/pm/help.js +92 -0
- package/packages/plugin-pm/scripts/pm/help.sh +90 -0
- package/packages/plugin-pm/scripts/pm/in-progress.js +178 -0
- package/packages/plugin-pm/scripts/pm/in-progress.sh +93 -0
- package/packages/plugin-pm/scripts/pm/init.js +321 -0
- package/packages/plugin-pm/scripts/pm/init.sh +178 -0
- package/packages/plugin-pm/scripts/pm/issue-close.js +232 -0
- package/packages/plugin-pm/scripts/pm/issue-edit.js +310 -0
- package/packages/plugin-pm/scripts/pm/issue-show.js +272 -0
- package/packages/plugin-pm/scripts/pm/issue-start.js +181 -0
- package/packages/plugin-pm/scripts/pm/issue-sync/format-comment.sh +468 -0
- package/packages/plugin-pm/scripts/pm/issue-sync/gather-updates.sh +460 -0
- package/packages/plugin-pm/scripts/pm/issue-sync/post-comment.sh +330 -0
- package/packages/plugin-pm/scripts/pm/issue-sync/preflight-validation.sh +348 -0
- package/packages/plugin-pm/scripts/pm/issue-sync/update-frontmatter.sh +387 -0
- package/packages/plugin-pm/scripts/pm/lib/README.md +85 -0
- package/packages/plugin-pm/scripts/pm/lib/epic-discovery.js +119 -0
- package/packages/plugin-pm/scripts/pm/lib/logger.js +78 -0
- package/packages/plugin-pm/scripts/pm/next.js +189 -0
- package/packages/plugin-pm/scripts/pm/next.sh +72 -0
- package/packages/plugin-pm/scripts/pm/optimize.js +407 -0
- package/packages/plugin-pm/scripts/pm/pr-create.js +337 -0
- package/packages/plugin-pm/scripts/pm/pr-list.js +257 -0
- package/packages/plugin-pm/scripts/pm/prd-list.js +242 -0
- package/packages/plugin-pm/scripts/pm/prd-list.sh +103 -0
- package/packages/plugin-pm/scripts/pm/prd-new.js +684 -0
- package/packages/plugin-pm/scripts/pm/prd-parse.js +547 -0
- package/packages/plugin-pm/scripts/pm/prd-status.js +152 -0
- package/packages/plugin-pm/scripts/pm/prd-status.sh +63 -0
- package/packages/plugin-pm/scripts/pm/release.js +460 -0
- package/packages/plugin-pm/scripts/pm/search.js +192 -0
- package/packages/plugin-pm/scripts/pm/search.sh +89 -0
- package/packages/plugin-pm/scripts/pm/standup.js +362 -0
- package/packages/plugin-pm/scripts/pm/standup.sh +95 -0
- package/packages/plugin-pm/scripts/pm/status.js +148 -0
- package/packages/plugin-pm/scripts/pm/status.sh +59 -0
- package/packages/plugin-pm/scripts/pm/sync-batch.js +337 -0
- package/packages/plugin-pm/scripts/pm/sync.js +343 -0
- package/packages/plugin-pm/scripts/pm/template-list.js +141 -0
- package/packages/plugin-pm/scripts/pm/template-new.js +366 -0
- package/packages/plugin-pm/scripts/pm/validate.js +274 -0
- package/packages/plugin-pm/scripts/pm/validate.sh +106 -0
- package/packages/plugin-pm/scripts/pm/what-next.js +660 -0
- package/packages/plugin-testing/README.md +401 -0
- package/packages/plugin-testing/agents/frontend-testing-engineer.md +768 -0
- package/packages/plugin-testing/commands/jest-optimize.md +800 -0
- package/packages/plugin-testing/commands/playwright-optimize.md +887 -0
- package/packages/plugin-testing/commands/test-coverage.md +512 -0
- package/packages/plugin-testing/commands/test-performance.md +1041 -0
- package/packages/plugin-testing/commands/test-setup.md +414 -0
- package/packages/plugin-testing/package.json +40 -0
- package/packages/plugin-testing/plugin.json +197 -0
- package/packages/plugin-testing/rules/test-coverage-requirements.md +581 -0
- package/packages/plugin-testing/rules/testing-standards.md +529 -0
- package/packages/plugin-testing/scripts/examples/react-testing-example.test.jsx +460 -0
- package/packages/plugin-testing/scripts/examples/vitest-config-example.js +352 -0
- package/packages/plugin-testing/scripts/examples/vue-testing-example.test.js +586 -0
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
# test:performance
|
|
2
|
+
|
|
3
|
+
Comprehensive testing performance optimization across all testing frameworks with Context7-verified best practices.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
Unified performance optimization for entire test ecosystem:
|
|
8
|
+
- Jest unit/integration testing
|
|
9
|
+
- Playwright E2E testing
|
|
10
|
+
- Vitest component testing
|
|
11
|
+
- Database testing optimization
|
|
12
|
+
- CI/CD pipeline optimization
|
|
13
|
+
- Test infrastructure best practices
|
|
14
|
+
|
|
15
|
+
## Required Documentation Access
|
|
16
|
+
|
|
17
|
+
**MANDATORY:** Before optimization, query Context7 for testing best practices:
|
|
18
|
+
|
|
19
|
+
**Documentation Queries:**
|
|
20
|
+
- `mcp://context7/nodejs-testing/performance` - Node.js testing performance patterns
|
|
21
|
+
- `mcp://context7/jest/optimization` - Jest optimization strategies
|
|
22
|
+
- `mcp://context7/playwright/performance` - Playwright E2E optimization
|
|
23
|
+
- `mcp://context7/vitest/concurrent` - Vitest concurrent testing
|
|
24
|
+
- `mcp://context7/testing/database` - Database testing optimization
|
|
25
|
+
- `mcp://context7/testing/ci-cd` - CI/CD pipeline optimization
|
|
26
|
+
|
|
27
|
+
**Why This is Required:**
|
|
28
|
+
- Ensures optimization follows industry best practices
|
|
29
|
+
- Applies proven patterns across all test types
|
|
30
|
+
- Validates framework-specific optimizations
|
|
31
|
+
- Prevents flaky tests and race conditions
|
|
32
|
+
- Optimizes resource utilization
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
/test:performance [options]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Options
|
|
41
|
+
|
|
42
|
+
- `--scope <unit|e2e|integration|database|all>` - Optimization scope (default: all)
|
|
43
|
+
- `--analyze-only` - Analyze without applying changes
|
|
44
|
+
- `--output <file>` - Write optimization report
|
|
45
|
+
- `--framework <jest|playwright|vitest|all>` - Target framework
|
|
46
|
+
- `--ci-optimize` - Optimize for CI/CD environment
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
### Full Test Suite Optimization
|
|
51
|
+
```bash
|
|
52
|
+
/test:performance
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Framework-Specific Optimization
|
|
56
|
+
```bash
|
|
57
|
+
/test:performance --framework jest
|
|
58
|
+
/test:performance --framework playwright
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### CI/CD Pipeline Optimization
|
|
62
|
+
```bash
|
|
63
|
+
/test:performance --ci-optimize
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Analyze Current Performance
|
|
67
|
+
```bash
|
|
68
|
+
/test:performance --analyze-only --output performance-report.md
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Database Tests Only
|
|
72
|
+
```bash
|
|
73
|
+
/test:performance --scope database
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Optimization Categories
|
|
77
|
+
|
|
78
|
+
### 1. Cross-Framework Parallel Execution (Context7-Verified)
|
|
79
|
+
|
|
80
|
+
**Pattern from Context7 (/goldbergyoni/nodejs-testing-best-practices):**
|
|
81
|
+
|
|
82
|
+
#### Package.json Scripts
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"scripts": {
|
|
86
|
+
"test": "npm-run-all --parallel test:unit test:integration",
|
|
87
|
+
"test:unit": "jest --testPathPattern=unit --maxWorkers=50%",
|
|
88
|
+
"test:integration": "jest --testPathPattern=integration --maxWorkers=2",
|
|
89
|
+
"test:e2e": "playwright test --workers=4",
|
|
90
|
+
"test:all": "npm-run-all test:unit test:integration test:e2e",
|
|
91
|
+
"test:ci": "npm-run-all --parallel test:unit test:integration && npm run test:e2e"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Benefits:**
|
|
97
|
+
- Run unit and integration tests in parallel
|
|
98
|
+
- Different worker configurations per test type
|
|
99
|
+
- Sequential E2E after faster tests
|
|
100
|
+
|
|
101
|
+
**Performance Impact:**
|
|
102
|
+
- Sequential: 25 minutes (unit: 5m + integration: 10m + E2E: 10m)
|
|
103
|
+
- Parallel: 15 minutes (unit||integration: 10m + E2E: 10m)
|
|
104
|
+
- Improvement: 1.67x faster (10 minutes saved)
|
|
105
|
+
|
|
106
|
+
#### GitHub Actions Parallel Jobs
|
|
107
|
+
```yaml
|
|
108
|
+
# .github/workflows/test.yml
|
|
109
|
+
name: Test Suite
|
|
110
|
+
on: [push, pull_request]
|
|
111
|
+
|
|
112
|
+
jobs:
|
|
113
|
+
unit-tests:
|
|
114
|
+
runs-on: ubuntu-latest
|
|
115
|
+
strategy:
|
|
116
|
+
matrix:
|
|
117
|
+
shard: [1/3, 2/3, 3/3]
|
|
118
|
+
steps:
|
|
119
|
+
- uses: actions/checkout@v3
|
|
120
|
+
- uses: actions/setup-node@v3
|
|
121
|
+
with:
|
|
122
|
+
node-version: 18
|
|
123
|
+
cache: 'npm'
|
|
124
|
+
- run: npm ci
|
|
125
|
+
- run: npm run test:unit -- --shard=${{ matrix.shard }}
|
|
126
|
+
|
|
127
|
+
integration-tests:
|
|
128
|
+
runs-on: ubuntu-latest
|
|
129
|
+
services:
|
|
130
|
+
postgres:
|
|
131
|
+
image: postgres:13
|
|
132
|
+
env:
|
|
133
|
+
POSTGRES_PASSWORD: postgres
|
|
134
|
+
options: >-
|
|
135
|
+
--health-cmd pg_isready
|
|
136
|
+
--health-interval 10s
|
|
137
|
+
--health-timeout 5s
|
|
138
|
+
--health-retries 5
|
|
139
|
+
steps:
|
|
140
|
+
- uses: actions/checkout@v3
|
|
141
|
+
- uses: actions/setup-node@v3
|
|
142
|
+
with:
|
|
143
|
+
node-version: 18
|
|
144
|
+
cache: 'npm'
|
|
145
|
+
- run: npm ci
|
|
146
|
+
- run: npm run test:integration
|
|
147
|
+
env:
|
|
148
|
+
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/test
|
|
149
|
+
|
|
150
|
+
e2e-tests:
|
|
151
|
+
runs-on: ubuntu-latest
|
|
152
|
+
needs: [unit-tests, integration-tests]
|
|
153
|
+
strategy:
|
|
154
|
+
matrix:
|
|
155
|
+
shard: [1/4, 2/4, 3/4, 4/4]
|
|
156
|
+
steps:
|
|
157
|
+
- uses: actions/checkout@v3
|
|
158
|
+
- uses: actions/setup-node@v3
|
|
159
|
+
with:
|
|
160
|
+
node-version: 18
|
|
161
|
+
cache: 'npm'
|
|
162
|
+
- run: npm ci
|
|
163
|
+
- run: npx playwright install --with-deps
|
|
164
|
+
- run: npm run test:e2e -- --shard=${{ matrix.shard }}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Benefits:**
|
|
168
|
+
- Parallel job execution across test types
|
|
169
|
+
- Unit tests sharded 3 ways (3x speedup)
|
|
170
|
+
- E2E tests sharded 4 ways (4x speedup)
|
|
171
|
+
- Integration tests run concurrently with unit tests
|
|
172
|
+
- E2E only runs if unit/integration pass
|
|
173
|
+
|
|
174
|
+
**Performance Impact:**
|
|
175
|
+
- Sequential: 25 minutes
|
|
176
|
+
- Parallel with sharding: 5 minutes (5x faster)
|
|
177
|
+
|
|
178
|
+
**Cost Analysis:**
|
|
179
|
+
- Sequential: 25 runner-minutes
|
|
180
|
+
- Parallel: 35 runner-minutes (unit: 3×2.5 + integration: 10 + E2E: 4×2.5)
|
|
181
|
+
- Trade-off: 40% more runner-minutes, but 5x faster delivery
|
|
182
|
+
|
|
183
|
+
### 2. Database Testing Optimization (Context7-Verified)
|
|
184
|
+
|
|
185
|
+
**Pattern from Context7 (/goldbergyoni/nodejs-testing-best-practices):**
|
|
186
|
+
|
|
187
|
+
#### Optimized Docker Compose for All Databases
|
|
188
|
+
```yaml
|
|
189
|
+
# docker-compose.test.yml
|
|
190
|
+
version: "3.9"
|
|
191
|
+
|
|
192
|
+
services:
|
|
193
|
+
# PostgreSQL optimized for testing
|
|
194
|
+
postgres:
|
|
195
|
+
image: postgres:15-alpine
|
|
196
|
+
command: |
|
|
197
|
+
postgres
|
|
198
|
+
-c fsync=off
|
|
199
|
+
-c synchronous_commit=off
|
|
200
|
+
-c full_page_writes=off
|
|
201
|
+
-c random_page_cost=1.0
|
|
202
|
+
-c shared_buffers=256MB
|
|
203
|
+
-c effective_cache_size=512MB
|
|
204
|
+
-c maintenance_work_mem=64MB
|
|
205
|
+
tmpfs:
|
|
206
|
+
- /var/lib/postgresql/data
|
|
207
|
+
environment:
|
|
208
|
+
POSTGRES_USER: test
|
|
209
|
+
POSTGRES_PASSWORD: test
|
|
210
|
+
POSTGRES_DB: testdb
|
|
211
|
+
ports:
|
|
212
|
+
- "5432:5432"
|
|
213
|
+
healthcheck:
|
|
214
|
+
test: ["CMD-SHELL", "pg_isready -U test"]
|
|
215
|
+
interval: 5s
|
|
216
|
+
timeout: 5s
|
|
217
|
+
retries: 5
|
|
218
|
+
|
|
219
|
+
# MySQL optimized for testing
|
|
220
|
+
mysql:
|
|
221
|
+
image: mysql:8.0
|
|
222
|
+
command: |
|
|
223
|
+
--default-authentication-plugin=mysql_native_password
|
|
224
|
+
--innodb_flush_log_at_trx_commit=0
|
|
225
|
+
--innodb_flush_method=O_DIRECT_NO_FSYNC
|
|
226
|
+
--innodb_doublewrite=0
|
|
227
|
+
--sync_binlog=0
|
|
228
|
+
tmpfs:
|
|
229
|
+
- /var/lib/mysql
|
|
230
|
+
environment:
|
|
231
|
+
MYSQL_ROOT_PASSWORD: test
|
|
232
|
+
MYSQL_DATABASE: testdb
|
|
233
|
+
ports:
|
|
234
|
+
- "3306:3306"
|
|
235
|
+
healthcheck:
|
|
236
|
+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
|
237
|
+
interval: 5s
|
|
238
|
+
timeout: 5s
|
|
239
|
+
retries: 5
|
|
240
|
+
|
|
241
|
+
# MongoDB optimized for testing
|
|
242
|
+
mongodb:
|
|
243
|
+
image: mongo:7-jammy
|
|
244
|
+
command: mongod --nojournal --wiredTigerCacheSizeGB 0.25
|
|
245
|
+
tmpfs:
|
|
246
|
+
- /data/db
|
|
247
|
+
environment:
|
|
248
|
+
MONGO_INITDB_ROOT_USERNAME: test
|
|
249
|
+
MONGO_INITDB_ROOT_PASSWORD: test
|
|
250
|
+
ports:
|
|
251
|
+
- "27017:27017"
|
|
252
|
+
healthcheck:
|
|
253
|
+
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
|
|
254
|
+
interval: 5s
|
|
255
|
+
timeout: 5s
|
|
256
|
+
retries: 5
|
|
257
|
+
|
|
258
|
+
# Redis optimized for testing
|
|
259
|
+
redis:
|
|
260
|
+
image: redis:7-alpine
|
|
261
|
+
command: redis-server --save "" --appendonly no --maxmemory 256mb
|
|
262
|
+
tmpfs:
|
|
263
|
+
- /data
|
|
264
|
+
ports:
|
|
265
|
+
- "6379:6379"
|
|
266
|
+
healthcheck:
|
|
267
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
268
|
+
interval: 5s
|
|
269
|
+
timeout: 5s
|
|
270
|
+
retries: 5
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Performance Impact per Database:**
|
|
274
|
+
- PostgreSQL: 10x faster (fsync=off + tmpfs)
|
|
275
|
+
- MySQL: 8x faster (innodb optimizations + tmpfs)
|
|
276
|
+
- MongoDB: 8x faster (nojournal + tmpfs)
|
|
277
|
+
- Redis: 15x faster (no persistence + tmpfs)
|
|
278
|
+
|
|
279
|
+
#### Test Setup with Database Optimization
|
|
280
|
+
```javascript
|
|
281
|
+
// test/setup-db.js
|
|
282
|
+
import { execSync } from 'child_process';
|
|
283
|
+
import { setTimeout } from 'timers/promises';
|
|
284
|
+
|
|
285
|
+
export default async function setupDatabase() {
|
|
286
|
+
// Start optimized database containers
|
|
287
|
+
console.log('Starting test databases...');
|
|
288
|
+
execSync('docker-compose -f docker-compose.test.yml up -d', {
|
|
289
|
+
stdio: 'inherit'
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// Wait for health checks
|
|
293
|
+
console.log('Waiting for databases to be ready...');
|
|
294
|
+
await setTimeout(5000);
|
|
295
|
+
|
|
296
|
+
// Verify all databases are healthy
|
|
297
|
+
const services = ['postgres', 'mysql', 'mongodb', 'redis'];
|
|
298
|
+
for (const service of services) {
|
|
299
|
+
const result = execSync(
|
|
300
|
+
`docker-compose -f docker-compose.test.yml ps ${service} --format json`,
|
|
301
|
+
{ encoding: 'utf-8' }
|
|
302
|
+
);
|
|
303
|
+
const status = JSON.parse(result);
|
|
304
|
+
if (status.Health !== 'healthy') {
|
|
305
|
+
throw new Error(`${service} is not healthy: ${status.Health}`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
console.log('All databases ready!');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// test/teardown-db.js
|
|
313
|
+
import { execSync } from 'child_process';
|
|
314
|
+
|
|
315
|
+
export default async function teardownDatabase() {
|
|
316
|
+
console.log('Stopping test databases...');
|
|
317
|
+
execSync('docker-compose -f docker-compose.test.yml down -v', {
|
|
318
|
+
stdio: 'inherit'
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### Jest Configuration with Database
|
|
324
|
+
```javascript
|
|
325
|
+
// jest.config.js
|
|
326
|
+
module.exports = {
|
|
327
|
+
globalSetup: './test/setup-db.js',
|
|
328
|
+
globalTeardown: './test/teardown-db.js',
|
|
329
|
+
|
|
330
|
+
testTimeout: 30000,
|
|
331
|
+
maxWorkers: '50%',
|
|
332
|
+
|
|
333
|
+
// Database test configuration
|
|
334
|
+
projects: [
|
|
335
|
+
{
|
|
336
|
+
displayName: 'postgres',
|
|
337
|
+
testMatch: ['**/test/postgres/**/*.test.js'],
|
|
338
|
+
setupFilesAfterEnv: ['<rootDir>/test/postgres-setup.js'],
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
displayName: 'mongodb',
|
|
342
|
+
testMatch: ['**/test/mongodb/**/*.test.js'],
|
|
343
|
+
setupFilesAfterEnv: ['<rootDir>/test/mongodb-setup.js'],
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
};
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### 3. Vitest Concurrent Testing (Context7-Verified)
|
|
350
|
+
|
|
351
|
+
**Pattern from Context7 (/vitest-dev/vitest):**
|
|
352
|
+
|
|
353
|
+
#### Vitest Configuration with Concurrency
|
|
354
|
+
```typescript
|
|
355
|
+
// vitest.config.ts
|
|
356
|
+
import { defineConfig } from 'vitest/config';
|
|
357
|
+
|
|
358
|
+
export default defineConfig({
|
|
359
|
+
test: {
|
|
360
|
+
// Enable concurrent test execution
|
|
361
|
+
threads: true,
|
|
362
|
+
maxThreads: 8,
|
|
363
|
+
minThreads: 1,
|
|
364
|
+
|
|
365
|
+
// Pool options
|
|
366
|
+
pool: 'threads', // or 'forks' for better isolation
|
|
367
|
+
|
|
368
|
+
// Browser testing
|
|
369
|
+
browser: {
|
|
370
|
+
enabled: false,
|
|
371
|
+
name: 'chromium',
|
|
372
|
+
provider: 'playwright',
|
|
373
|
+
instances: 4, // Parallel browser instances
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
// Coverage
|
|
377
|
+
coverage: {
|
|
378
|
+
provider: 'v8',
|
|
379
|
+
reporter: ['text', 'json', 'html'],
|
|
380
|
+
exclude: [
|
|
381
|
+
'node_modules/',
|
|
382
|
+
'test/',
|
|
383
|
+
'**/*.test.ts',
|
|
384
|
+
'**/*.spec.ts',
|
|
385
|
+
],
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
// Test sharding
|
|
389
|
+
shard: process.env.CI
|
|
390
|
+
? { index: Number(process.env.VITEST_SHARD_INDEX) || 1,
|
|
391
|
+
total: Number(process.env.VITEST_SHARD_TOTAL) || 1 }
|
|
392
|
+
: undefined,
|
|
393
|
+
},
|
|
394
|
+
});
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
#### Concurrent Test Patterns
|
|
398
|
+
```typescript
|
|
399
|
+
import { describe, test, expect } from 'vitest';
|
|
400
|
+
|
|
401
|
+
// Concurrent tests in suite
|
|
402
|
+
describe.concurrent('API endpoints', () => {
|
|
403
|
+
test('GET /users', async () => {
|
|
404
|
+
const response = await fetch('http://localhost:3000/users');
|
|
405
|
+
expect(response.status).toBe(200);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
test('GET /posts', async () => {
|
|
409
|
+
const response = await fetch('http://localhost:3000/posts');
|
|
410
|
+
expect(response.status).toBe(200);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
test('GET /comments', async () => {
|
|
414
|
+
const response = await fetch('http://localhost:3000/comments');
|
|
415
|
+
expect(response.status).toBe(200);
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// Sequential suite with concurrent tests
|
|
420
|
+
describe.sequential('Database operations', () => {
|
|
421
|
+
test.concurrent('insert user', async () => {
|
|
422
|
+
await db.users.insert({ name: 'John' });
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
test.concurrent('insert post', async () => {
|
|
426
|
+
await db.posts.insert({ title: 'Test' });
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
// Control concurrency limit
|
|
431
|
+
describe.concurrent('Rate-limited API', { concurrent: 2 }, () => {
|
|
432
|
+
// Only 2 tests run concurrently
|
|
433
|
+
test('request 1', async () => { /* ... */ });
|
|
434
|
+
test('request 2', async () => { /* ... */ });
|
|
435
|
+
test('request 3', async () => { /* ... */ });
|
|
436
|
+
test('request 4', async () => { /* ... */ });
|
|
437
|
+
});
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
**Performance Impact:**
|
|
441
|
+
- Sequential: 10 seconds (10 tests × 1s each)
|
|
442
|
+
- Concurrent: 2 seconds (10 tests / 5 threads = 2s)
|
|
443
|
+
- Improvement: 5x faster
|
|
444
|
+
|
|
445
|
+
#### Vitest Test Sharding
|
|
446
|
+
```bash
|
|
447
|
+
# Run sharded tests locally
|
|
448
|
+
vitest run --shard=1/3
|
|
449
|
+
vitest run --shard=2/3
|
|
450
|
+
vitest run --shard=3/3
|
|
451
|
+
|
|
452
|
+
# GitHub Actions
|
|
453
|
+
VITEST_SHARD_INDEX=1 VITEST_SHARD_TOTAL=3 vitest run
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### 4. Test Cleanup Best Practices (Context7-Verified)
|
|
457
|
+
|
|
458
|
+
**Pattern from Context7 (/goldbergyoni/nodejs-testing-best-practices):**
|
|
459
|
+
|
|
460
|
+
#### Transaction-Based Cleanup (PostgreSQL/MySQL)
|
|
461
|
+
```javascript
|
|
462
|
+
// test/transaction-setup.js
|
|
463
|
+
import { PrismaClient } from '@prisma/client';
|
|
464
|
+
|
|
465
|
+
const prisma = new PrismaClient();
|
|
466
|
+
|
|
467
|
+
beforeEach(async () => {
|
|
468
|
+
// Start transaction for test isolation
|
|
469
|
+
await prisma.$executeRaw`BEGIN`;
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
afterEach(async () => {
|
|
473
|
+
// Rollback transaction (instant cleanup)
|
|
474
|
+
await prisma.$executeRaw`ROLLBACK`;
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
afterAll(async () => {
|
|
478
|
+
await prisma.$disconnect();
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
// Usage in tests
|
|
482
|
+
describe('User service', () => {
|
|
483
|
+
it('should create user', async () => {
|
|
484
|
+
const user = await prisma.user.create({
|
|
485
|
+
data: { name: 'John', email: 'john@example.com' }
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
expect(user.name).toBe('John');
|
|
489
|
+
// Automatically rolled back after test
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
**Benefits:**
|
|
495
|
+
- Instant cleanup (no DELETE queries)
|
|
496
|
+
- Perfect test isolation
|
|
497
|
+
- No leftover data
|
|
498
|
+
|
|
499
|
+
**Performance Impact:** 5x faster cleanup (500ms → 100ms)
|
|
500
|
+
|
|
501
|
+
#### Truncate Tables Strategy
|
|
502
|
+
```javascript
|
|
503
|
+
// test/truncate-setup.js
|
|
504
|
+
import { sequelize } from '../src/database';
|
|
505
|
+
|
|
506
|
+
const tables = ['users', 'posts', 'comments', 'likes'];
|
|
507
|
+
|
|
508
|
+
afterEach(async () => {
|
|
509
|
+
// Disable foreign key checks
|
|
510
|
+
await sequelize.query('SET FOREIGN_KEY_CHECKS = 0');
|
|
511
|
+
|
|
512
|
+
// Truncate all tables
|
|
513
|
+
await Promise.all(
|
|
514
|
+
tables.map(table =>
|
|
515
|
+
sequelize.query(`TRUNCATE TABLE ${table}`)
|
|
516
|
+
)
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
// Re-enable foreign key checks
|
|
520
|
+
await sequelize.query('SET FOREIGN_KEY_CHECKS = 1');
|
|
521
|
+
});
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
**Performance Impact:** 3x faster than DELETE FROM
|
|
525
|
+
|
|
526
|
+
#### MongoDB Cleanup
|
|
527
|
+
```javascript
|
|
528
|
+
// test/mongodb-setup.js
|
|
529
|
+
import { MongoClient } from 'mongodb';
|
|
530
|
+
|
|
531
|
+
let client;
|
|
532
|
+
let db;
|
|
533
|
+
|
|
534
|
+
beforeAll(async () => {
|
|
535
|
+
client = await MongoClient.connect('mongodb://test:test@localhost:27017');
|
|
536
|
+
db = client.db('testdb');
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
afterEach(async () => {
|
|
540
|
+
// Drop all collections (fastest cleanup)
|
|
541
|
+
const collections = await db.listCollections().toArray();
|
|
542
|
+
await Promise.all(
|
|
543
|
+
collections.map(({ name }) => db.collection(name).drop())
|
|
544
|
+
);
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
afterAll(async () => {
|
|
548
|
+
await client.close();
|
|
549
|
+
});
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
**Performance Impact:** 10x faster than deleteMany
|
|
553
|
+
|
|
554
|
+
### 5. HTTP Mocking for Performance (Context7-Verified)
|
|
555
|
+
|
|
556
|
+
**Pattern from Context7 (/goldbergyoni/nodejs-testing-best-practices):**
|
|
557
|
+
|
|
558
|
+
#### Unified HTTP Interceptor
|
|
559
|
+
```javascript
|
|
560
|
+
// test/http-mock.js
|
|
561
|
+
import nock from 'nock';
|
|
562
|
+
|
|
563
|
+
export function setupHttpMocks() {
|
|
564
|
+
beforeEach(() => {
|
|
565
|
+
// Enable HTTP interception
|
|
566
|
+
nock.cleanAll();
|
|
567
|
+
nock.enableNetConnect('127.0.0.1'); // Allow localhost
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
afterEach(() => {
|
|
571
|
+
// Verify all mocks were used
|
|
572
|
+
if (!nock.isDone()) {
|
|
573
|
+
console.error('Unused HTTP mocks:', nock.pendingMocks());
|
|
574
|
+
nock.cleanAll();
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
afterAll(() => {
|
|
579
|
+
nock.restore();
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// Common API mocks
|
|
584
|
+
export const apiMocks = {
|
|
585
|
+
users: {
|
|
586
|
+
getAll: () => nock('https://api.example.com')
|
|
587
|
+
.get('/users')
|
|
588
|
+
.reply(200, [
|
|
589
|
+
{ id: 1, name: 'John' },
|
|
590
|
+
{ id: 2, name: 'Jane' }
|
|
591
|
+
]),
|
|
592
|
+
|
|
593
|
+
getOne: (id, data) => nock('https://api.example.com')
|
|
594
|
+
.get(`/users/${id}`)
|
|
595
|
+
.reply(200, data),
|
|
596
|
+
|
|
597
|
+
create: (data) => nock('https://api.example.com')
|
|
598
|
+
.post('/users', data)
|
|
599
|
+
.reply(201, { id: 123, ...data }),
|
|
600
|
+
|
|
601
|
+
error: (code, message) => nock('https://api.example.com')
|
|
602
|
+
.get(/\/users\/.*/)
|
|
603
|
+
.reply(code, { error: message }),
|
|
604
|
+
},
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
// Usage in tests
|
|
608
|
+
import { setupHttpMocks, apiMocks } from './http-mock';
|
|
609
|
+
|
|
610
|
+
describe('User service', () => {
|
|
611
|
+
setupHttpMocks();
|
|
612
|
+
|
|
613
|
+
it('should fetch users', async () => {
|
|
614
|
+
apiMocks.users.getAll();
|
|
615
|
+
|
|
616
|
+
const users = await userService.fetchUsers();
|
|
617
|
+
expect(users).toHaveLength(2);
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
it('should handle errors', async () => {
|
|
621
|
+
apiMocks.users.error(404, 'User not found');
|
|
622
|
+
|
|
623
|
+
await expect(userService.fetchUser(999))
|
|
624
|
+
.rejects.toThrow('User not found');
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
**Performance Impact:**
|
|
630
|
+
- Real HTTP: 500ms per test
|
|
631
|
+
- Mocked HTTP: 5ms per test
|
|
632
|
+
- Improvement: 100x faster
|
|
633
|
+
|
|
634
|
+
### 6. Memory Optimization (Context7-Verified)
|
|
635
|
+
|
|
636
|
+
**Pattern from Context7 (/goldbergyoni/nodejs-testing-best-practices):**
|
|
637
|
+
|
|
638
|
+
#### Jest Memory Configuration
|
|
639
|
+
```javascript
|
|
640
|
+
// jest.config.js
|
|
641
|
+
module.exports = {
|
|
642
|
+
// Limit memory per worker
|
|
643
|
+
maxWorkers: '50%',
|
|
644
|
+
workerIdleMemoryLimit: '512MB',
|
|
645
|
+
|
|
646
|
+
// Clear mocks between tests
|
|
647
|
+
clearMocks: true,
|
|
648
|
+
resetMocks: true,
|
|
649
|
+
restoreMocks: true,
|
|
650
|
+
|
|
651
|
+
// Detect memory leaks
|
|
652
|
+
detectLeaks: process.env.CI ? true : false,
|
|
653
|
+
detectOpenHandles: process.env.CI ? true : false,
|
|
654
|
+
|
|
655
|
+
// Test timeout
|
|
656
|
+
testTimeout: 30000,
|
|
657
|
+
};
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
#### Package.json Scripts
|
|
661
|
+
```json
|
|
662
|
+
{
|
|
663
|
+
"scripts": {
|
|
664
|
+
"test": "NODE_OPTIONS='--max-old-space-size=4096' jest",
|
|
665
|
+
"test:leaks": "jest --detectLeaks --runInBand",
|
|
666
|
+
"test:handles": "jest --detectOpenHandles --forceExit"
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
### 7. CI/CD Pipeline Optimization (Context7-Verified)
|
|
672
|
+
|
|
673
|
+
**Pattern from Context7:**
|
|
674
|
+
|
|
675
|
+
#### Optimized GitHub Actions Workflow
|
|
676
|
+
```yaml
|
|
677
|
+
# .github/workflows/test-optimized.yml
|
|
678
|
+
name: Optimized Test Pipeline
|
|
679
|
+
on:
|
|
680
|
+
push:
|
|
681
|
+
branches: [main]
|
|
682
|
+
pull_request:
|
|
683
|
+
|
|
684
|
+
env:
|
|
685
|
+
NODE_VERSION: 18
|
|
686
|
+
CACHE_VERSION: v1
|
|
687
|
+
|
|
688
|
+
jobs:
|
|
689
|
+
# Job 1: Setup and Cache
|
|
690
|
+
setup:
|
|
691
|
+
runs-on: ubuntu-latest
|
|
692
|
+
outputs:
|
|
693
|
+
cache-key: ${{ steps.cache-keys.outputs.node-modules }}
|
|
694
|
+
steps:
|
|
695
|
+
- uses: actions/checkout@v3
|
|
696
|
+
|
|
697
|
+
- name: Generate cache keys
|
|
698
|
+
id: cache-keys
|
|
699
|
+
run: |
|
|
700
|
+
echo "node-modules=${{ env.CACHE_VERSION }}-${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}" >> $GITHUB_OUTPUT
|
|
701
|
+
|
|
702
|
+
- uses: actions/setup-node@v3
|
|
703
|
+
with:
|
|
704
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
705
|
+
cache: 'npm'
|
|
706
|
+
|
|
707
|
+
- name: Cache node modules
|
|
708
|
+
uses: actions/cache@v3
|
|
709
|
+
id: cache
|
|
710
|
+
with:
|
|
711
|
+
path: node_modules
|
|
712
|
+
key: ${{ steps.cache-keys.outputs.node-modules }}
|
|
713
|
+
|
|
714
|
+
- name: Install dependencies
|
|
715
|
+
if: steps.cache.outputs.cache-hit != 'true'
|
|
716
|
+
run: npm ci
|
|
717
|
+
|
|
718
|
+
# Job 2: Unit Tests (3 shards)
|
|
719
|
+
unit-tests:
|
|
720
|
+
needs: setup
|
|
721
|
+
runs-on: ubuntu-latest
|
|
722
|
+
strategy:
|
|
723
|
+
fail-fast: false
|
|
724
|
+
matrix:
|
|
725
|
+
shard: [1, 2, 3]
|
|
726
|
+
steps:
|
|
727
|
+
- uses: actions/checkout@v3
|
|
728
|
+
- uses: actions/setup-node@v3
|
|
729
|
+
with:
|
|
730
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
731
|
+
|
|
732
|
+
- name: Restore node modules
|
|
733
|
+
uses: actions/cache@v3
|
|
734
|
+
with:
|
|
735
|
+
path: node_modules
|
|
736
|
+
key: ${{ needs.setup.outputs.cache-key }}
|
|
737
|
+
|
|
738
|
+
- name: Run unit tests
|
|
739
|
+
run: npm run test:unit -- --shard=${{ matrix.shard }}/3 --coverage
|
|
740
|
+
|
|
741
|
+
- name: Upload coverage
|
|
742
|
+
uses: actions/upload-artifact@v3
|
|
743
|
+
with:
|
|
744
|
+
name: coverage-unit-${{ matrix.shard }}
|
|
745
|
+
path: coverage/
|
|
746
|
+
|
|
747
|
+
# Job 3: Integration Tests
|
|
748
|
+
integration-tests:
|
|
749
|
+
needs: setup
|
|
750
|
+
runs-on: ubuntu-latest
|
|
751
|
+
services:
|
|
752
|
+
postgres:
|
|
753
|
+
image: postgres:15-alpine
|
|
754
|
+
env:
|
|
755
|
+
POSTGRES_PASSWORD: postgres
|
|
756
|
+
options: >-
|
|
757
|
+
--health-cmd pg_isready
|
|
758
|
+
--health-interval 10s
|
|
759
|
+
--tmpfs /var/lib/postgresql/data
|
|
760
|
+
steps:
|
|
761
|
+
- uses: actions/checkout@v3
|
|
762
|
+
- uses: actions/setup-node@v3
|
|
763
|
+
with:
|
|
764
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
765
|
+
|
|
766
|
+
- name: Restore node modules
|
|
767
|
+
uses: actions/cache@v3
|
|
768
|
+
with:
|
|
769
|
+
path: node_modules
|
|
770
|
+
key: ${{ needs.setup.outputs.cache-key }}
|
|
771
|
+
|
|
772
|
+
- name: Run integration tests
|
|
773
|
+
run: npm run test:integration
|
|
774
|
+
env:
|
|
775
|
+
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/test
|
|
776
|
+
|
|
777
|
+
# Job 4: E2E Tests (4 shards)
|
|
778
|
+
e2e-tests:
|
|
779
|
+
needs: [unit-tests, integration-tests]
|
|
780
|
+
runs-on: ubuntu-latest
|
|
781
|
+
strategy:
|
|
782
|
+
fail-fast: false
|
|
783
|
+
matrix:
|
|
784
|
+
shard: [1, 2, 3, 4]
|
|
785
|
+
steps:
|
|
786
|
+
- uses: actions/checkout@v3
|
|
787
|
+
- uses: actions/setup-node@v3
|
|
788
|
+
with:
|
|
789
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
790
|
+
|
|
791
|
+
- name: Restore node modules
|
|
792
|
+
uses: actions/cache@v3
|
|
793
|
+
with:
|
|
794
|
+
path: node_modules
|
|
795
|
+
key: ${{ needs.setup.outputs.cache-key }}
|
|
796
|
+
|
|
797
|
+
- name: Cache Playwright browsers
|
|
798
|
+
uses: actions/cache@v3
|
|
799
|
+
with:
|
|
800
|
+
path: ~/.cache/ms-playwright
|
|
801
|
+
key: playwright-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
|
802
|
+
|
|
803
|
+
- name: Install Playwright
|
|
804
|
+
run: npx playwright install --with-deps
|
|
805
|
+
|
|
806
|
+
- name: Run E2E tests
|
|
807
|
+
run: npm run test:e2e -- --shard=${{ matrix.shard }}/4
|
|
808
|
+
|
|
809
|
+
- name: Upload test results
|
|
810
|
+
if: always()
|
|
811
|
+
uses: actions/upload-artifact@v3
|
|
812
|
+
with:
|
|
813
|
+
name: playwright-report-${{ matrix.shard }}
|
|
814
|
+
path: playwright-report/
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
**Performance Impact:**
|
|
818
|
+
- Sequential pipeline: 35 minutes
|
|
819
|
+
- Optimized parallel: 6 minutes (5.8x faster)
|
|
820
|
+
- Cost: Same runner-minutes, much faster feedback
|
|
821
|
+
|
|
822
|
+
## Optimization Output
|
|
823
|
+
|
|
824
|
+
```
|
|
825
|
+
🚀 Comprehensive Test Performance Analysis
|
|
826
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
827
|
+
|
|
828
|
+
Project: Full Stack Application
|
|
829
|
+
Testing Frameworks: Jest, Playwright, Vitest
|
|
830
|
+
Total Tests: 2,134 (Unit: 1,247 | Integration: 400 | E2E: 487)
|
|
831
|
+
|
|
832
|
+
📊 Current Performance Baseline
|
|
833
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
834
|
+
|
|
835
|
+
Test Suite Breakdown:
|
|
836
|
+
- Unit tests (Jest): 8m 34s
|
|
837
|
+
- Integration tests (Jest): 12m 45s
|
|
838
|
+
- E2E tests (Playwright): 28m 34s
|
|
839
|
+
Total Sequential: 49m 53s
|
|
840
|
+
|
|
841
|
+
CI/CD Pipeline: 55m 12s
|
|
842
|
+
- Setup: 2m 15s
|
|
843
|
+
- Unit: 8m 34s
|
|
844
|
+
- Integration: 12m 45s
|
|
845
|
+
- E2E: 28m 34s
|
|
846
|
+
- Coverage: 3m 04s
|
|
847
|
+
|
|
848
|
+
⚡ Parallel Execution Optimization
|
|
849
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
850
|
+
|
|
851
|
+
Current: Sequential execution
|
|
852
|
+
Recommended: Parallel with sharding
|
|
853
|
+
|
|
854
|
+
💡 Optimizations:
|
|
855
|
+
1. Unit tests: 3 shards → 2m 51s (3x faster)
|
|
856
|
+
2. Integration: 2 workers → 6m 23s (2x faster)
|
|
857
|
+
3. E2E tests: 4 shards → 7m 8s (4x faster)
|
|
858
|
+
|
|
859
|
+
New Timeline (Parallel):
|
|
860
|
+
- Setup: 1m 30s (cached dependencies)
|
|
861
|
+
- Unit || Integration: 6m 23s (parallel jobs)
|
|
862
|
+
- E2E: 7m 8s (depends on unit+integration)
|
|
863
|
+
Total: 15m 1s (3.3x faster)
|
|
864
|
+
|
|
865
|
+
💾 Database Optimization
|
|
866
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
867
|
+
|
|
868
|
+
⚠️ Using production-like database configuration
|
|
869
|
+
Current: 12m 45s for integration tests
|
|
870
|
+
|
|
871
|
+
💡 Optimizations:
|
|
872
|
+
1. tmpfs storage → 10x faster I/O
|
|
873
|
+
2. Disable fsync → 3x faster writes
|
|
874
|
+
3. Transaction rollback cleanup → 5x faster
|
|
875
|
+
4. Connection pooling → 2x faster
|
|
876
|
+
|
|
877
|
+
Docker Compose generated with:
|
|
878
|
+
- PostgreSQL: fsync=off + tmpfs
|
|
879
|
+
- MongoDB: nojournal + tmpfs
|
|
880
|
+
- Redis: no persistence + tmpfs
|
|
881
|
+
|
|
882
|
+
⚡ Impact:
|
|
883
|
+
- Current: 12m 45s
|
|
884
|
+
- Optimized: 1m 17s (10x faster)
|
|
885
|
+
|
|
886
|
+
🌐 HTTP Mocking
|
|
887
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
888
|
+
|
|
889
|
+
⚠️ 234 tests making real HTTP requests
|
|
890
|
+
|
|
891
|
+
💡 Optimization: Use nock for interception
|
|
892
|
+
|
|
893
|
+
⚡ Impact:
|
|
894
|
+
- Current: 117s total (500ms × 234 tests)
|
|
895
|
+
- With nock: 1.2s total (5ms × 234 tests)
|
|
896
|
+
- Speedup: 100x faster, 0% flaky
|
|
897
|
+
|
|
898
|
+
HTTP mock library configured ✓
|
|
899
|
+
|
|
900
|
+
📈 CI/CD Pipeline Optimization
|
|
901
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
902
|
+
|
|
903
|
+
Current Pipeline: 55m 12s
|
|
904
|
+
|
|
905
|
+
Optimizations Applied:
|
|
906
|
+
1. Dependency caching → 2m 15s → 30s (4.5x faster)
|
|
907
|
+
2. Parallel test jobs → Run simultaneously
|
|
908
|
+
3. Test sharding → Linear speedup
|
|
909
|
+
4. Browser caching → 1m 30s → 10s (9x faster)
|
|
910
|
+
5. Optimized databases → 12m 45s → 1m 17s (10x faster)
|
|
911
|
+
|
|
912
|
+
New Pipeline Timeline:
|
|
913
|
+
- Setup (cached): 30s
|
|
914
|
+
- Unit (3 shards) || Integration: 2m 51s (parallel)
|
|
915
|
+
- E2E (4 shards): 7m 8s
|
|
916
|
+
Total: 10m 29s (5.3x faster)
|
|
917
|
+
|
|
918
|
+
GitHub Actions workflow generated ✓
|
|
919
|
+
|
|
920
|
+
🎯 Summary
|
|
921
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
922
|
+
|
|
923
|
+
Total Optimizations: 24
|
|
924
|
+
|
|
925
|
+
🔴 Critical: 6 (parallel execution, sharding, database)
|
|
926
|
+
🟡 High Impact: 10 (HTTP mocking, caching, cleanup)
|
|
927
|
+
🟢 Low Impact: 8 (configuration, grouping)
|
|
928
|
+
|
|
929
|
+
Performance Improvements:
|
|
930
|
+
|
|
931
|
+
Local Development:
|
|
932
|
+
- Before: 49m 53s
|
|
933
|
+
- After: 7m 8s (7x faster)
|
|
934
|
+
|
|
935
|
+
CI/CD Pipeline:
|
|
936
|
+
- Before: 55m 12s
|
|
937
|
+
- After: 10m 29s (5.3x faster)
|
|
938
|
+
|
|
939
|
+
Test Reliability:
|
|
940
|
+
- Flaky tests (real HTTP/DB): 8% failure rate
|
|
941
|
+
- Optimized (mocked/isolated): <1% failure rate
|
|
942
|
+
|
|
943
|
+
Resource Usage:
|
|
944
|
+
- Database I/O: 10x faster (tmpfs)
|
|
945
|
+
- Network requests: 100x faster (mocked)
|
|
946
|
+
- Memory usage: 40% reduction
|
|
947
|
+
- Storage: 80% reduction (traces/videos on failure)
|
|
948
|
+
|
|
949
|
+
Cost Impact:
|
|
950
|
+
- CI runner-minutes: +20% (more parallelism)
|
|
951
|
+
- Delivery speed: 5.3x faster
|
|
952
|
+
- Developer productivity: +400% (faster feedback)
|
|
953
|
+
|
|
954
|
+
Run with --apply to implement all optimizations
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
## Implementation
|
|
958
|
+
|
|
959
|
+
This command uses multiple agents for comprehensive optimization:
|
|
960
|
+
|
|
961
|
+
1. **@frontend-testing-engineer** - Component testing optimization
|
|
962
|
+
2. **@nodejs-backend-engineer** - Integration test optimization
|
|
963
|
+
3. **@e2e-test-engineer** - E2E test optimization
|
|
964
|
+
|
|
965
|
+
**Workflow:**
|
|
966
|
+
1. Query Context7 for best practices across all frameworks
|
|
967
|
+
2. Analyze current test suite performance
|
|
968
|
+
3. Identify optimization opportunities per framework
|
|
969
|
+
4. Configure parallel execution and sharding
|
|
970
|
+
5. Optimize database testing infrastructure
|
|
971
|
+
6. Generate CI/CD pipeline configuration
|
|
972
|
+
7. Apply all optimizations with verification
|
|
973
|
+
|
|
974
|
+
## Best Practices Applied
|
|
975
|
+
|
|
976
|
+
Based on Context7 documentation from multiple sources:
|
|
977
|
+
|
|
978
|
+
1. **Parallel Execution** - Run test types concurrently
|
|
979
|
+
2. **Test Sharding** - Distribute across CI runners (3-4x speedup)
|
|
980
|
+
3. **Database Optimization** - tmpfs + fsync=off (10x speedup)
|
|
981
|
+
4. **HTTP Mocking** - nock interception (100x speedup)
|
|
982
|
+
5. **Transaction Cleanup** - Instant rollback (5x speedup)
|
|
983
|
+
6. **CI/CD Caching** - Dependencies and browsers (4-9x speedup)
|
|
984
|
+
7. **Conditional Traces** - Only on failures (12x faster, 10x less storage)
|
|
985
|
+
|
|
986
|
+
## Related Commands
|
|
987
|
+
|
|
988
|
+
- `/jest:optimize` - Jest-specific optimization
|
|
989
|
+
- `/playwright:optimize` - E2E-specific optimization
|
|
990
|
+
- `/test:setup` - Initial test configuration
|
|
991
|
+
- `/test:coverage` - Coverage analysis
|
|
992
|
+
|
|
993
|
+
## Troubleshooting
|
|
994
|
+
|
|
995
|
+
### Tests Still Slow
|
|
996
|
+
- Check database configuration (tmpfs enabled?)
|
|
997
|
+
- Verify HTTP mocking is active
|
|
998
|
+
- Review test sharding distribution
|
|
999
|
+
- Check worker configuration
|
|
1000
|
+
|
|
1001
|
+
### Flaky Tests
|
|
1002
|
+
- Mock all external dependencies
|
|
1003
|
+
- Use transaction-based cleanup
|
|
1004
|
+
- Check for shared state
|
|
1005
|
+
- Verify test isolation
|
|
1006
|
+
|
|
1007
|
+
### Out of Memory
|
|
1008
|
+
- Reduce `maxWorkers` value
|
|
1009
|
+
- Increase `--max-old-space-size`
|
|
1010
|
+
- Check for memory leaks with `--detectLeaks`
|
|
1011
|
+
|
|
1012
|
+
### CI/CD Pipeline Slow
|
|
1013
|
+
- Implement test sharding
|
|
1014
|
+
- Enable dependency caching
|
|
1015
|
+
- Use optimized Docker images
|
|
1016
|
+
- Parallelize test jobs
|
|
1017
|
+
|
|
1018
|
+
## Installation
|
|
1019
|
+
|
|
1020
|
+
```bash
|
|
1021
|
+
# Install testing frameworks
|
|
1022
|
+
npm install --save-dev jest @playwright/test vitest
|
|
1023
|
+
|
|
1024
|
+
# Install utilities
|
|
1025
|
+
npm install --save-dev nock npm-run-all
|
|
1026
|
+
|
|
1027
|
+
# Setup databases
|
|
1028
|
+
docker-compose -f docker-compose.test.yml up -d
|
|
1029
|
+
|
|
1030
|
+
# Verify setup
|
|
1031
|
+
npm run test:performance -- --analyze-only
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
## Version History
|
|
1035
|
+
|
|
1036
|
+
- v2.0.0 - Initial Schema v2.0 release with Context7 integration
|
|
1037
|
+
- Unified testing optimization across Jest, Playwright, Vitest
|
|
1038
|
+
- Database optimization with tmpfs
|
|
1039
|
+
- HTTP mocking patterns
|
|
1040
|
+
- CI/CD pipeline optimization
|
|
1041
|
+
- Test sharding strategies
|