Hello All, When i am running provider tests. Getti...
# pact-js
m
Hello All, When i am running provider tests. Getting the following error. Can someone help me with this please
Copy code
1) Pact Verification
       validates the contract provided by the consumer:
     Error: pactffiVerifierBrokerSourceWithSelectors(arg 10) expected an array of strings
      at Object.validateAndExecute (node_modules/@pact-foundation/pact-core/src/verifier/argumentMapper/arguments.js:115:21)
      at /Users/maheshdamavarapu/GSGRepos/POC-BE-Automation/ContractTesting-GraphQL/node_modules/@pact-foundation/pact-core/src/verifier/argumentMapper/index.js:36:57
      at Array.forEach (<anonymous>)
      at setupVerification (node_modules/@pact-foundation/pact-core/src/verifier/argumentMapper/index.js:34:11)
      at verify (node_modules/@pact-foundation/pact-core/src/verifier/nativeVerifier.js:38:44)
      at Verifier.verify (node_modules/@pact-foundation/pact-core/src/verifier/index.js:21:44)
      at Pact.verifyPacts (node_modules/@pact-foundation/pact-core/src/pact.js:125:49)
      at /Users/maheshdamavarapu/GSGRepos/POC-BE-Automation/ContractTesting-GraphQL/node_modules/@pact-foundation/pact/src/dsl/verifier/verifier.js:134:40
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
“@pact-foundation/pact”: “^12.0.0", I am using ApolloGraphQLInteraction My Provider Code
Copy code
describe('Pact Verification', () => {
  it('validates the contract provided by the consumer', () => {
    const opts = {
      provider: 'GraphQLProvider',
      providerBaseUrl: '<http://localhost:4000/>',
      pactBrokerUrl: '<https://gsg.pactflow.io>',
      pactBrokerToken: 'OACUwt9HTivsWUMSCUdjJg',
      tags: ['test'],
      publishVerificationResult: true,
      providerVersion: '1.0.1',
      logLevel: 'DEBUG',
      consumerVersionTags: '1.0',
    };

    return new Verifier(opts).verifyProvider().then(output => {
      console.log('Pact Verification Completed')
      console.log('________________-----------------__________'+output);
    });
  });
});
m
Check the values against the rules accepted in the verifier constructor
I think cosumerVersionTags should be an array but I'm on my phone so it's a guess
t
I think this is actually a bug - the validator and the docs say that it can be an array or a string, but the internal types only accept an array. The offending line is (at least) here
you can work around this by changing to
consumerVersionTags: ['1.0']
m
thanks Tim, that code needs some rework as you have pointed out previously.
joyfacepalm 1
t
Haha! Oops 😅