-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorupstreamIndicates that an issue relates to an upstream problem (such as in pact-reference)Indicates that an issue relates to an upstream problem (such as in pact-reference)
Description
Software versions
- OS: macOS Monterey Version 12.0.1 (21A559)
- Pact Node version: 10.17.6
- Node Version: 16.13.0
Issue Checklist
Please confirm the following:
- I have upgraded to the latest
- I have the read the FAQs in the Readme
- I have triple checked, that there are no unhandled promises in my code
- I have set my log level to debug and attached a log file showing the complete request/response cycle
- For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem
Expected behaviour
I have defined a provider interaction like below. After executing that test and feeding the created PACT file into a stub server, I'd expect to get a successful response for any request in the form of /animals?id=<SOME_NUMBER>.
// Provider interaction in PACT Test
await provider.addInteraction({
state: "there are animals",
uponReceiving: "a request for a specific animal",
withRequest: {
path: "/animals",
method: "GET",
query: {
id: term({
generate: "123",
matcher: "\\d+",
}),
},
},
willRespondWith: {
status: 200,
headers: {
"Content-Type": "application/json",
},
body: {
id: term({
generate: "123",
matcher: "\\d+",
}),
name: like("dog"),
},
},
});
// ...
// Starting a stub server
import { Stub } from "@pact-foundation/pact-node";
const pactStub = new Stub({ pactUrls: pactFiles, port: 4000, logLevel: "debug" });
await pactStub.start();Actual behaviour
When the stub server boots, it will print the following error to the console
[email protected]: Pact Binary Error: WARN: Ignoring unsupported matching rules {"match"=>"regex", "regex"=>"\\d+"} for path $['query']$['id'][0]
and any request to /animals?id=<SOME_NUMBER> with SOME_NUMBER !== 123 will yield a 500 response. I have found this issue and this seems to have been a problem in the past that has been fixed already. However, I was not able to get it running with the latest version of @pact-foundation/pact-node.
Steps to reproduce
I've uploaded a minimal reproducible example here: https://github.com/calvinbayer/pact-stub-server-repro
Relevant log files
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorupstreamIndicates that an issue relates to an upstream problem (such as in pact-reference)Indicates that an issue relates to an upstream problem (such as in pact-reference)