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
[V3] Pact.log is gone? #909
Comments
if you expect your client code to throw an error, you need to handle that in your testing framework https://jestjs.io/docs/tutorial-async#rejects jest will check that a function returns a rejected promise with your error message an example with mocha https://github.com/pact-foundation/pact-js/blob/master/examples/e2e/test/consumer.spec.js#L130 Any chance you could provide more of your test code? |
Sure:
httpRequest is just a thin wrapper around axios. |
Thanks for raising. The issue is because we throw immediately if we get an error, but we should still report the failure in those cases (see https://github.com/pact-foundation/pact-js/blob/master/src/v3/pact.ts#L214). This should be easy enough to do. We currently don't expose a way to log to file, but if we properly logged to the terminal would that solve your issue @Maxim-Filimonov ? |
I think logging to terminal would be at least some solution. Old pact did a very easy to understand |
Clossing as this has been implemented. |
Thank you for making a feature request! We appreciate it very much. GitHub Issues are a big input into the priorities for Pact-JS development
All italic text in this template is safe to remove before submitting
Thanks again!
Checklist
This checklist is optional, but studies show that people who have followed it checklist are really excellent people and we like them
Before making a feature request, I have:
Feature description
To be able to see logs in pact.log again. It seems that pact.log is completely gone with V3.
Use case
So that it's possible to diagnose a mismatch issue without putting lots of console logs in my codebase and staring at errors like that:
I still have no clue what is it trying to tell me.
To add a bit more contex. Apparently, this particular issue happens if my own code throws an error on 500. In that scenario I cannot see pact logs which tell me what was the mismatch.
I was able to circumvent it with empty try catch:
And then I get proper errors:
Wondering if it's expected and should pact catch all exceptions and return them back with mismatches?
The text was updated successfully, but these errors were encountered: