After update: Provider state parameters not rendered into contract JSON for request path parameters
See original GitHub issueSoftware versions
- OS: Mac OSX 12.5
- Pact Node version:
@pact-foundation/pact-core@13.7.7
- Node Version:
v16.15.1
- Other Versions: Pulled as dependency of
@pact-foundation/pact@10.1.1
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
When writing a consumer test, where the setup uses a fromProviderState()
matcher on a request path parameter, the resulting Pact JSON file should contain a generator and matchingRule for this provider state parameter.
Actual behaviour
After updating from @pact-foundation/pact@10.0.2
to @pact-foundation/pact@10.1.1
, the Pact JSON file does not contain a corresponding generator/matchingRule.
This is only true for path parameters - for provider state parameters from query parameters or body parameters, this still works as expected.
Steps to reproduce
E.g. with the provider-state-injected
example (https://github.com/pact-foundation/pact-js/tree/master/examples/v3/provider-state-injected):
- Run the consumer contract test & save the resulting pact JSON file
- Upgrade the pact dependency in the package.json from
10.0.2
to10.1.1
- Run the consumer contract test again & compare the resulting JSON files
This is what I get:
diff TransactionService-AccountService-v10.0.2.json TransactionService-AccountService-v10.1.1.json
329,344c329,330
< "generators": {
< "path": {
< "expression": "/data/${uuid}",
< "type": "ProviderState"
< }
< },
< "matchingRules": {
< "path": {
< "combine": "AND",
< "matchers": [
< {
< "match": "type"
< }
< ]
< }
< },
---
> "generators": {},
> "matchingRules": {},
381c367
< "version": "10.0.2"
---
> "version": "10.1.1"
384,385c370,371
< "ffi": "0.2.4",
< "models": "0.3.1"
---
> "ffi": "0.3.5",
> "models": "0.4.1"
Relevant log files
None
I hope this is the right repo to open this issue - if it should go to pact-js instead, let me know and I can open it there instead 🙇
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Can also confirm from our side that it works again 👍 Thanks for the quick fix!
13.7.9 is now out.