Harris Lee
07/11/2022, 2:08 AMstateHandler
, we will use real provider side API to generate data, however, when stateHandler is failed, it does not execute the other tests, what is good practice workaround in here? for example, some verifier from provider side doesnt need stateHandler, if state handler somehow error/fail, shall we execute rest of them? any good tip for jest setup for provider? we use jest-each
to loop all contract in provider side.
each(needToBeVerified).it('should verify the expectations of %p Graphql', contractName => {
return new Verifier(createOptions(`${contractName}-provider`)).verifyProvider().then(output => {
if (output.includes('Diff')) {
console.log(output)
throw new Error(`${contractName} contract test error`)
}
})
Timothy Jones
07/11/2022, 6:18 AMcreateOptions
function do? If the state handler fails, Pact assumes that the test is a failure, because the state was not correctly setup.Timothy Jones
07/11/2022, 6:19 AMTimothy Jones
07/11/2022, 6:20 AMif (output.includes('Diff')) {
- Diff happens to be in the output of a failed test, but it's not part of the contractTimothy Jones
07/11/2022, 6:21 AMeach(needToBeVerified).it(
<-- I'm not familiar with this construct - the one that is in the jest docs is it.each(table)(name,fn,timeout?)
Timothy Jones
07/11/2022, 6:22 AMHarris Lee
07/11/2022, 10:42 PMcreateOptions
is just verifier config, such as
{
provider: providerName,
providerBaseUrl: ,
pactBrokerUrl:
}
Harris Lee
07/11/2022, 10:42 PMDiff happens to be in the output of a failed test, but it’s not part of the contractOK that is good to know thanks! I will add failure
Harris Lee
07/11/2022, 10:43 PMHarris Lee
07/11/2022, 10:44 PMit should execute the contracts where the failing state handler is not used successfully.yeap that is what I expected lol, I will try different way! thanks a lot.