A verifier interface represents a provider during Pact contract verification. It checks whether a running provider satisfies the interactions recorded in consumer contracts, rather than testing every provider business rule. section 6.3.1 section 6.6
A practical provider verification setup typically:
- Starts the provider service and makes its base URL available to the test. section 6.3.1
- Configures the provider name, broker connection, provider version, publication behavior, and consumer version tags. section 6.3.1
- Creates a Verifier instance, calls verifyProvider, reports the result, and closes the service. section 6.3.1
- Keeps broader business-rule coverage in separate functional tests. section 6.6
MoviesAPI provider verification
A provider test starts the MoviesAPI locally, configures providerBaseUrl as its address, retrieves consumer contracts through the Pact Broker, and verifies the consumer version tagged main. It publishes the verification result and closes the server after completion. section 6.3.1
const options = {
provider: 'MoviesAPI',
providerBaseUrl: `http://localhost:${port}`,
pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,
pactBrokerToken: process.env.PACT_BROKER_TOKEN,
providerVersion: '1.0.0',
publishVerificationResult: true,
consumerVersionTags: ['main'],
};
const verifier = new Verifier(options);
The options object shows how provider identity, access, broker credentials, versioning, result publication, and consumer selection shape verification. section 6.3.1
