Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
Pact-JS - Get pact verification response

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The short answer is no.

The pact provider verification does a few things:

  1. It reads in the given contracts / fetches them from a Pact Broker. These contracts represent the needs of its consumers.
  2. For each interaction in the contract (of which there are usually many), Pact assumes the role of an API client and issues the requests and asserts on the response
  3. It reports back the success or failure of this.

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)?

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!