Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda