Hello everyone, my team updated to version `10.0.0...
# pact-js
t
Hello everyone, my team updated to version
10.0.0-beta.56
to get the timeout fix https://github.com/pact-foundation/pact-js/issues/761 We are running into an issue were the state handlers teardown is no longer being called. I don't see any change in the signature of the state handlers between
10.0.0-beta.54
and the version we are using now. Anyone have any ideas why the teardown isn't be executed? I'll include an example of the code in the thread.
Code Example:
Copy code
"State Handler": {
        resourceId: undefined,
        setup: async () => {
          console.log("Setup")
          resourceId = await setupState();
          return Promise.resolve({
            queryId: resourceId
          });
        },
        teardown: async () => {
          console.log('Teardown')
          await teardownState(resourceId);
        },
      }
m
Not sure timelines of versions but there was a bug whereby the flag to tear down wasn't being used and always did a tear down, on the rust side during a verify: https://github.com/pact-foundation/pact-reference/pull/167 Iirc there's just a flag when calling the verifier to use them
--state-change-teardown
m
Hi Timothy! hmm, it should support them. Any chance you could please share a debug log for us to take a look at?
The change Mike contributed should be in the latest JS though
m
The bug I looked at was it always sent them even without the flag, the logic meant it was always true, so maybe some backwards compatibility issue introduced
m
ah
m
If it is related to that, I forgot to check this morning
On mobile again :) the default was don't send, but the default didn't work
m
Actually, that handler definition looks incorrect to me
nvm, I’m tired.
I mean, there is a superfluous key there (
resourceId
) but that shouldn’t break things
m
I think just calling pact-verifier with --state-change-teardown should do it, if it is related to that
👍 1
m
That might be it. We moved the core from the CLI version of the verifier to the handle based on. It could be missed in that change
just realised you’re not on the latest. Can you please check out
10.0.0-beta.58
?
Just ran it locally and can see setup/teardown running OK
t
I'll try the
--state-change-teardown
and if that doesn't work I'll see about bumping the version to the latest.
👍 1
The
--state-change-teardown
arg didn't have any effect. But bumping to version to
10.0.0-beta.58
did work. The teardowns are now being executed.
🙌 1
m
Glad to hear it's working, and also glad it wasn't broken as a result of my fix 😀
m
Awesome, thanks for confirming Timothy.
We’re back on track with the JS release now - so there will likely be a bunch of more beta updates before we cut over
The main thing left to do is plumb in message pact into the new core and then stabilise the public API
thanks for the feedback!