pact-js
                                
                                 pact-js copied to clipboard
                                
                                    pact-js copied to clipboard
                            
                            
                            
                        Improve console error messages when consumer tests fail
Issue Classification
- [X] Feature request
Feature Request
Currently, the error messages when a consumer test fails to match the expectations are not very detailled. Many users don't realise they can look in the log to get more detailed errors.
We should improve this behaviour - at a minimum, we could add an error message directing users to the log file.
Ideally, we'd have a detailed copy of the failure that could be logged. For pacts generated with the ruby binaries (the current master release of pact-js uses pact-node's ruby binaries), we could improve the mock service to return detailed information: https://github.com/pact-foundation/pact-mock_service/issues/123
This.
I've been meaning to do this for a while.
Doesn't the js show the output that says "look at this log file? though"
          Pact::MockService::VerificationFailedError:
            Actual interactions do not match expected interactions for mock Bar.
            Missing requests:
            	GET /thing2
            Unexpected requests:
            	GET /thing
            See log/bar_mock_service.log for details.
It does.
Here's an example failure from the e2e example in the repo:
 
One option would be to return structured error data + messages in the verification call, which can then be logged using the native JS (or whatever client's) log framework.
EDIT: the provider side log file is not logged to the console, so that would be an improvement on that side of things (I also didn't know it existed for a long time)