Abdurahman Hijazi
06/24/2022, 10:32 AM1) Pact verification:
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:372:5)
at URL.onParseError (node:internal/url:553:9)
at new URL (node:internal/url:629:5)
at Verifier.isLocalVerification (node_modules\@pact-foundation\pact\src\dsl\verifier.js:302:17)
at Verifier.setConfig (node_modules\@pact-foundation\pact\src\dsl\verifier.js:295:23)
at Verifier.verifyProvider (node_modules\@pact-foundation\pact\src\dsl\verifier.js:86:18)
at Context.<anonymous> (test\provider.spec.js:27:25)
at processImmediate (node:internal/timers:466:21
Line 27 is the return line below
return new Verifier(opts).verifyProvider().then(() => {
console.log("Pacts verified and published");
});
Matt (pactflow.io / pact-js / pact-go)
Abdurahman Hijazi
06/24/2022, 10:34 AMlet opts = {
pactBroker: "<http://hijazi.pactflow.io>",
provider: "Node API (Provider)",
consumerVersionTags: ["main"],
publishVerificationResult: true, //generally you'd do something like `<http://process.env.CI|process.env.CI> === 'true'`
providerVersion: "version 1.0", //recommended to be the git sha
providerVersionTag: "1.0",
stateHandlers: {
//If you have defined any states in your consumer tests, the Verifier can put the provider into the
//right state prior to sending the request.
},
beforeEach: () => {
console.log('I run before everything else')
},
afterEach: () => {
console.log('I run after everything else has finished')
}
};
Matt (pactflow.io / pact-js / pact-go)
providerBaseUrl
argumentMatt (pactflow.io / pact-js / pact-go)
Abdurahman Hijazi
06/24/2022, 10:35 AMMatt (pactflow.io / pact-js / pact-go)
opts
Abdurahman Hijazi
06/24/2022, 10:36 AMMatt (pactflow.io / pact-js / pact-go)
Abdurahman Hijazi
06/24/2022, 10:38 AMError: Must provide the pactUrls argument if no pactBrokerUrl provided
Abdurahman Hijazi
06/24/2022, 10:38 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
pactBroker
is not pactBrokerUrl
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Abdurahman Hijazi
06/24/2022, 3:20 PMreturn
the pact doesn't pass, and even when it does pass, it's not calling my API
This is my verifier method without return
new Verifier(opts).verifyProvider()
.then(output => {
console.log("Pacts verified and published");
console.log(output);
})
Matt (pactflow.io / pact-js / pact-go)
return new Verifier(opts)…
. If so, you must do that, otherwise you’re not properly handling the promise.
If you don’t know what that means, I highly suggest you pair with a developerMatt (pactflow.io / pact-js / pact-go)
and even when it does pass, it’s not calling my APISo to help you understand what might be going wrong, i’d suggest following the debugging guide in the readme and coming back here with the information you’ve found