pact-mock_service
pact-mock_service copied to clipboard
fail-fast on missing --pact_dir parameter
If one does not pass the --pact_dir parameter the mock service, it only fails when the first interaction has succeeded, i.e., when the service wants to persist the generated Pact file.
IMHO, the service should already check whether the parameter has been passed on startup so that users receive an indication early enough. This is especially important in high-volume CI environments where extensive test suites should not even need to start if the mock service hasn't started successfully.
The reason it's a late failure is that in the original code, the pact directory was sent through with the request, not at startup, so it was not possible to fail until that first request had come though. I'm pretty sure we can change it now, as I expect the older versions of that code are not in use. I would give it a default directory (probably "./pacts") rather than making it mandatory however.
Default directory sounds good. It'd even allow old versions to transition to new ones smoothly.