Closed gaeljw closed 1 year ago
Yeah I think this sounds like a nice thing to have! If you have time, please go ahead and open a PR 😋
Closing as the beforeEach was implemented in #378, and as mentioned on that PR, adding an after hook would involve lifting a lot of code out of the ProviderVerifier
class from pact-jvm to ensure that the after hook runs after each interaction has been run. This is not something I would like to do as it makes it easier for pact4s to fall out of step with pact-jvm
Unless I missing something, there's no "easy" way to define a beforeEach/afterEach logic to run automatically before or after each contract request verification on the provider side.
Take for instance the following code sample:
We have to put the
resetState()
call in every state.Would it make sense to have something like a
.withStateChangeBeforeHook { f() }
that would make the verifier automatically callf()
before each request verification?If you think it make sense, I'll be happy to help implement it.