contract-testing
支持 can-i-deploy 等网关策略,适合微服务间强契约场景保障集成安全。
依赖 Pact Broker 与凭据,部署与证书管理需要额外运维权限
使用 Pact-JS 实现消费者驱动的契约测试与 Broker 驱动的提供者验证流程。
用 Pact-JS 做消费者驱动的契约测试,消费者声明需要的 API,提供方在 CI 里验证自己能满足,并通过 Pact Broker/`can-i-deploy` 把兼容性作为部署门禁。适合需要避免前后端契约不一致在生产暴雷的微服务团队。特点是把契约当成 CI 流程的一等公民,支持 pending pact、Webhook 驱动的验证和部署阻断。
▸ 展开 SKILL.md 英文原文
Implement consumer-driven contract testing with Pact-JS (v16). Covers consumer test writing, broker-driven provider verification, Pact Broker setup, can-i-deploy as a deployment gate, webhook-triggered verification, pending pacts, and schema-first vs consumer-first approaches (OpenAPI/Ajv, Schemathesis). Use when: "contract test," "Pact," "consumer-driven," "API contract," "provider verification," "can-i-deploy." Not for: stubbing or mocking a dependency to isolate a test — use service-virtualization; general REST/GraphQL endpoint assertions against your own API — use api-testing. Related: api-testing, service-virtualization, ci-cd-integration, test-environments.
帮我安装这个 skill:https://raw.githubusercontent.com/petrkindlmann/qa-skills/main/skills/contract-testing/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/petrkindlmann/qa-skills/main/skills/contract-testing/SKILL.md"<objective> A provider renames a response field. Both services pass their own unit tests, and the mismatch only surfaces in production when the consumer's frontend breaks. Contract testing catches that in CI: the consumer declares exactly what it needs, the provider verifies it can deliver, and `can-i-deploy` blocks the deploy until the broker confirms both sides are compatible. This skill produces Pact consumer tests, broker-driven provider verification, and the deployment gate that ties them together — so services can be deployed independently without a shared integration environment. </objective> ## Discovery Questions Check `.agents/qa-project-context.md` first — if it exists, use it a