CodeVetter · Repo Unpack · Testing signals
pact-foundation/pact-js
Tests and CI were inspected, not executed; their existence establishes intended checks rather than passing results. Root Vitest combines mocked unit tests with native-backed integration tests, while examples and regression packages run consumer suites before provider suites. This is a bounded inspection, and the selected lifecycle specs do not establish coverage of every mismatch, persistence, transport, or cleanup failure branch.
- Root npm test maps to vitest run with a plugin-installing pretest; Vitest discovers src/**/*.spec.ts, uses forks and 60-second timeouts, writes JUnit output, and configures V8 coverage with 50% line/statement thresholds.
- The inspected V3 and V4 HTTP lifecycle specs replace ConsumerPact operations with mocks and assert CORS, HTTP/HTTPS selection, and a negative startup result; those files do not test mismatch rejection or write/cleanup exceptions.
- hooks.spec.ts drives synthetic setup/teardown requests to test once-per-interaction execution, multiple states, subsequent interactions after hook failure, continued next(), and retried setup idempotence.
- Verifier tests mock the proxy and check closure on resolution/rejection plus exclusion of TLS credentials from core options; proxyRequest tests inspect target credentials, SSL/origin options, proxy-env precedence, and readable buffers, without establishing a real mTLS handshake.
- pact.integration.spec.ts uses actual Axios and TCP interactions, reads generated pact JSON to assert metadata/references, and exercises the MATT plugin over HTTP and synchronous TCP.
- Regression configs explicitly enumerate consumer/provider files and alias the SDK to src/index.ts; provider configuration substitutes an aws-sdk mock and inlines graphql-http, while the package runs consumers before providers after cleaning pact outputs.
- Example suites cover application-client HTTP calls, GraphQL query requests, message handling/production, and provider-generated IDs; their manifests separate consumer and provider commands and order them in npm test.
- Test CI defines Node 22/24/26 across macOS, Linux x64/ARM, and Windows, plus Alpine, lint, format, examples, and regression jobs; the completion job rejects failed, cancelled, or skipped dependencies and unit jobs upload coverage/test reports.