pactflow / example-bi-directional-consumer-mountebank

Example BDCT consumer using Mountebank stubs
2 stars 29 forks source link

Empty pact files #7

Open apetitescure opened 1 year ago

apetitescure commented 1 year ago

Hello,

I'm trying the sample of example-bi-directional-consumer-mountebank on windows 10.

It run fines, but the pact file produce by the test does not contains any interactions in it, and eventually the publish scripts submit a blank contract on the pact-broker

Example of a produced file :

{
    "consumer": {
        "name": "pactflow-example-bi-directional-consumer-mountebank"
    },
    "provider": {
        "name": "pactflow-example-bi-directional-provider-dredd"
    },
    "interactions": [],
    "metadata": {
        "pactSpecification": {
            "version": "2.0.0"
        }
    }
}

Also I tried to debug the mountebankSerialiser.js and imposter.matches contained in imposter.stubs are undefined

I tried the exact same code on debian, and the interactions array is not empty.

Do you know how to fix ?

apetitescure commented 1 year ago

Hello again,

I noticed on debian that replacing in mountebank.js

export const startAndClearStubs = () => {
  spawn("mb", ["restart", "--debug", "true"]);

  return waitPort({
    port: mbPort,
    host: "localhost",
    output: "silent",
  });
};

by

export const startAndClearStubs = async () => {
    instance = await mb.create(
    {
        port: mbPort,
        pidfile: '../mb.pid',
        logfile: '../mb.log',
        protofile: '../protofile.json',
        ipWhitelist: ['*']
    });
};

cause the very same issue.