-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid pact file created after migration to pact v10: pact:matcher:type in response body #950
Comments
Can you please share the pact test? I think you're right, the regex can now be used without the double escape (that the ruby core needed) and that might be the issue. |
The full example pact test: |
Thanks. I think there must be a bug somewhere in the core, that is not happy with the JSON being sent to configure the application headers. I do think now it's not necessary to apply the But the bug needs fixing. Implementation notes to self - consider using the |
Wow, thanks for the fast response! I changed it to
and it works fine 👍 |
Great thanks for letting me know, we'll fix the other one. |
I'm not sure whether this is related, but here are some notes from my debugging. I'm using If I specify a .willRespondWith({
body: Matchers.like({ some: 'object' }),
headers: {
'Content-Type': Matchers.regex({
generate: "application/json; charset=utf-8",
matcher: "application/json",
}),
}
}) then the Pact file has the generated value in
|
Software versions
Issue Checklist
Please confirm the following:
Expected behaviour
Migration of consumer tests from pact 9 to pact 10 should be possible without major changes except the ones described in https://docs.pact.io/implementation_guides/javascript/docs/migrations/9-10.
The created pact file should still be valid.
Actual behaviour
After the update from pact 9 to pact 10, the pact mock response is wrong: It contains properties like
'pact:matcher:type': 'type', min: 1
. A pact file is still created, but contains invalid responses.Steps to reproduce
The created pact file looks like this:
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:
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
The text was updated successfully, but these errors were encountered: