I am using Pact.js first time for microservice testing. I tried to follow these following examples:
https://github.com/pact-foundation/pact-js/tree/master/examples/e2e
https://github.com/pact-foundation/pact-js/tree/master/examples/mocha
In example 3; I navigate into test folder and run mocha index.spec.js
But it throws the following error:
[2017-02-27T21:37:52.426Z] INFO: pact-node@4.8.0/38629 on Meliss-MacBook-Pro.local: Creating Pact with PID: 38630
1) "before all" hook
2) "after all" hook
0 passing (2s)
2 failing
1) The Dog API "before all" hook:
Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
2) The Dog API "after all" hook:
Error: connect ECONNREFUSED 127.0.0.1:8989
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
It creates the log
and pact
folders as expected, but it neither creates a pact.json
file in the pact folder nor logs files in the log folder.
What confuses me more is I get the exact same error in examples 1 and 2. This tells me that I have an issue on my side but I don't know what it is. Can someone help me to debug the issue?