pact-js
pact-js copied to clipboard
[Enhance] Better provider base url format error log
Software versions
- OS: Ubuntu 19.04
- Consumer Pact library: @pact-foundation/[email protected]
- Provider Pact library: @pact-foundation/[email protected]
- Node Version: 11.5.0
Expected behaviour
Expected to see an error more descriptive like provider-base-url format not allowed, expected format is /^https?:\/\/.*:\d*$/, this way errors with the provider base url format would be easier to debug.
Actual behaviour
While using 0.0.0.0:3001 as provider-base-url we got the following error, spent all day in slack chat to understand what was wrong, had to change it to http://localhost:3001.

Steps to reproduce
Just use 0.0.0.0 as provider base url with any port you want, with a localhost based api to verify, should get ENOTFOUND ${PORT} with little to no explanation about what's wrong.
Thanks for raising as discussed. We should pre-validate the correct format as part of setup. Marking as ready.