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
To properly test contracts its necessary to check the exact exitCode thrown by the contract.
Jest only allows to match the Error message. https://jestjs.io/docs/expect#tothrowerror
The text was updated successfully, but these errors were encountered:
Created a simple implementation, would be nice if this comes into the official release, please feel free to decide about the function name.
importjestGlobalfrom'@jest/globals';jestGlobal.expect.extend({toMatchExitCode: async(received: any,expected: number)=>{constresult={message: ()=>`expected exitCode: ${expected}`,pass: false,}try{awaitreceived();result.message=()=>`expected to throw Error with exitCode: ${expected}, no Error was thrown instead`}catch(e: any){result.pass=e.exitCode==expected;}returnresult}});declare global {exportnamespacejest{interfaceMatchers<R>{toMatchExitCode(code: number): R}}}
To properly test contracts its necessary to check the exact exitCode thrown by the contract.
Jest only allows to match the Error message. https://jestjs.io/docs/expect#tothrowerror
The text was updated successfully, but these errors were encountered: