I am using Pact-js with Jest, I am trying to get the response that returns the (real) API consumption from the provider side, the code is the following.
describe("Validate pact of identity", () => {
it("Validate pact of identity creation", () => {
let opts = {
providerBaseUrl: baseUrl.BASE_URL,
changeOrigin: true,
provider: "Create identity Service",
logLevel: "DEBUG",
pactUrls: [
path.resolve(
process.cwd(),
`./__tests__/contract/pacts/${requestData.nameConsumerPactFile}-${requestData.nameProviderPactFile}.json`
),
],
requestFilter: async (req, res, next) => {
req.headers["Authorization"] = `Bearer ${await postRequestToken(paths.TOKEN_NON_CDE)}`,
next()
},
consumerVersionTags: ["QA"],
providerVersionTags: ["QA"],
publishVerificationResult: false,
providerVersion: "1.0.0"
}
return new Verifier(opts).verifyProvider()
.then((res) => {
console.log('pact veryify complete, !!!');
console.log(res);
});
})
})
but the method Verifier(opts).verifyProvider() res variable value does not return the API response, is there any way to get the response after PACT does the verification?
The short answer is no.
The pact provider verification does a few things:
So it doesn't make sense to return the response, because there could be many.
What do you want to do with that response (or responses)?