Eoin K
12/18/2025, 9:22 AMVerifier is unable to verify both synchronous and asynchronous contracts for a singular Provider.
We can build a test solely for synchronous contracts using Verifier and solely for asynchronous contract using MessageProviderPact but using Verifier.messageProviders opt breaks those same verifications. We have created a example project to demonstrate. Does anyone have any experience of running asynchronous and synchronous side by side for one Provider? Any guidance would be appreciated
In other languages it appears that people get around this by using filters such as Java however pact-js doesn't have this. Filtering upon interaction type would solve our problem and allow us to verify both asynchronous and synchronous contracts for one Provider under two test files. To explore a possible solution, I made changes to the pact-js library to introduce comparable filter functionality in this draft fork. This was supported by AI and I have not contributed to pact-js before so I would be open to discussion if this is the correct approach
Thanks, Eoin : )Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Eoin K
12/18/2025, 1:50 PMEoin K
12/18/2025, 1:52 PMMatt (pactflow.io / pact-js / pact-go)
messageProviders. This looks to not be working as expected. Regular HTTP verifications are coming in through the proxy and into the HTTP provider (system under test). So I suspect it’s some switching/matching logic in there that’s failing.
Why it works for the V4 example I provided I don’t know yet, but might provide a clue
Messages are sent on a specific HTTP path and are then routedMatt (pactflow.io / pact-js / pact-go)
transports: this.config.transports?.concat([
{
port,
path: this.messageTransportPath,
protocol: 'message',
},
]),
Means if there are no user-defined transports, the message transport is not configured.
should be (something like)
transports: (this.config.transports || []).concat([
{
port,
path: this.messageTransportPath,
protocol: 'message',
},
]),Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)