GitHub
03/03/2023, 5:52 AM'pact:matcher:type': 'type', min: 1. A pact file is still created, but contains invalid responses.
Steps to reproduce
• clone https://github.com/M-Landwehr/poc/tree/pact-10-vs-pact-9
• run npm i and then npm t
The created pact file looks like this:
"response": {
"body": {
"result": {
"min": 1,
"pact:matcher:type": "type",
"value": [
{
"cancelled": {
"pact:matcher:type": "type",
"value": false
},
"complexObject": {
"pact:matcher:type": "type",
"value": {
"value": {
"pact:matcher:type": "type",
"value": "value"
}
}
},
"descriptions": {
"pact:matcher:type": "type",
"value": {
"en": {
"pact:matcher:type": "type",
"value": "foo"
}
}
},
"name": {
"pact:matcher:type": "type",
"value": "name"
}
}
]
}
},
This seems to be a regression in pact 10: After changing the version to ^9.0.0 in the package.json the pact file is valid.
According to the logs, the issue seems to be with the header matcher:
2022-09-23T11:08:11.354110Z WARN ThreadId(01) pact_models::content_types: Failed to parse '{"value":"application/json;charset=UTF-8","regex":"application/json(;\\s?charset=[\\w\\-]+)?","pact:matcher:type":"regex"}' as a content type: mime parse error: an invalid token was encountered, 7B at position 0
2022-09-23T11:08:11.354186Z WARN ThreadId(01) pact_models::content_types: Failed to parse '{"value":"application/json;charset=UTF-8","regex":"application/json(;\\s?charset=[\\w\\-]+)?","pact:matcher:type":"regex"}' as a content type: mime parse error: an invalid token was encountered, 7B at position 0
removing the headers section from the willRespondWith part in the spec.js file and rerunning the test also results in a correct pact file
Relevant log files
log.log
pact-foundation/pact-jsGitHub
03/03/2023, 5:52 AM