You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have triple checked, that there are no unhandled promises in my code and have read the section on intermittent test failures
I have set my log level to debug and attached a log file showing the complete request/response cycle
For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem
Expected behaviour
There are no TypeScript errors when trying to provide a stateHandler with setup and teardown to a Verifier.
Actual behaviour
Trying to provide a stateHandler with setup and teardown results in the following TypeScript error:
error TS2322: Type '{ setup: () => Promise<void>; teardown: () => Promise<void>; }' is not assignable to type 'StateHandler & ((state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>)'.
Type '{ setup: () => Promise<void>; teardown: () => Promise<void>; }' is not assignable to type 'StateFuncWithSetup & ((state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>)'.
Type '{ setup: () => Promise<void>; teardown: () => Promise<void>; }' is not assignable to type '(state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>'.
Type '{ setup: () => Promise<void>; teardown: () => Promise<void>; }' provides no match for the signature '(state: string, params?: { [name: string]: string; } | undefined): Promise<unknown>'.
Steps to reproduce
import{Verifier}from'@pact-foundation/pact';constverifier=newVerifier({stateHandlers: {'name of the stateHandler': {setup: async()=>{},teardown: async()=>{}}// this line produces a TypeScript error}});
The text was updated successfully, but these errors were encountered:
ghost91-
added
bug
Indicates an unexpected problem or unintended behavior
triage
This issue is yet to be triaged by a maintainer
labels
Jan 16, 2024
I've seen this error as well. It appears to be because VerifierOptions as defined in src/dsl/verifier/types.ts includes both ProxyOptions and MessageProviderOptions which each define stateHandlers differently. I am not very good with Typescript, but the error message thrown indicates that the transpiler is preferring the type definition of stateHandlers defined by MessageProviderOptions over the one provided by ProxyOptions.
Software versions
Please provide at least OS and version of pact-js
Issue Checklist
Please confirm the following:
Expected behaviour
There are no TypeScript errors when trying to provide a stateHandler with setup and teardown to a
Verifier
.Actual behaviour
Trying to provide a stateHandler with setup and teardown results in the following TypeScript error:
Steps to reproduce
The text was updated successfully, but these errors were encountered: