Hello there! Running some tests in node, but getti...
# pact-js
c
Hello there! Running some tests in node, but getting a surprising error:
pact-core@13.9.0: !!!!!!!!! PACT CRASHED !!!!!!!!!
After many pages of errors suggesting I file a bug, there is finally this line:
2022-09-21T19:09:23.148756Z ERROR ThreadId(02) pact_ffi::mock_server: Failed to start mock server - Could not start server: error creating server listener: Address already in use (os error 48)
. Anyone have any thoughts? It this indeed a bug that needs filing?
Copy code
@pact_foundation/pact 10.1.4
@pact_foundation/pact-core 13.9.0
node 16.17
mac os x
Eventually tracked it down! it appears I was failing to call
provider.verify()
! Thanks!
👍 1
m
ah!
So my guess is you’re using the old interface on the new upgrade (which is totally fine!) One of the reasons I like the new interface is that these lifecycle methods disappear along with this class of problem
👍 1
This also suggests to me you’re hard coding a port - i’d usually opt to avoid doing that if you can and let the OS pick one for you (you can do this by not passing
port
and getting back a port from
setup()
)
👍 1
t
Pact should detect a port conflict and not do the PACT CRASHED message, I think
☝️ 1
because it’s not a crash, it’s a misconfiguration
c
Very insightful! Thanks bit of you! I’ll try to find the time to update those tests!