Open magwas opened 1 year ago
Okay, I have found the problem. The default for -T is exact, and for -M is "". So if there is any stdin, there will not be matching mocks, unless some have set -T and/or -M.
It is a sane behaviour, though not apparent from the README.
Also, calls to mock without match return with exit status 99. This is also a sane behaviour, just utterly undocumented.
Sorry to bother you, but you have the most up-to-date repo of shellmock with issues open for submission. It is still the least worst mocking lib for bats. so I treat you here as acting maintainer. With the understanding that you have all rights not to act like one. I am willing to work on the issue, but have no idea where to start.
I have found that if the stub reads from a pipe, the exit status of it is 99. It only observable if that stub call is the last one in the sut, but doing TDD it is often the case, and it probably hints to some failure in the code running after the stub.
I would like that to be fixed.
I have minimal code to recreate and experiment with the problem. I left diagnostics in the test and commented out experiments in the sut.
The test:
batbug, the sut: