synpress icon indicating copy to clipboard operation
synpress copied to clipboard

[💡 Feature]: Validate all user inputs with zod

Open roninjin10 opened this issue 2 years ago • 0 comments

Is your feature request related to a problem?

Easy low hanging fruit is to validate all userInput with zod. E.g.

z.object({
  secretWordsOrPrivateKey: z.string().refine(isPrivateKeyOrSecretWords),
  ...,
}).parse(setupMetamaskOptions)

This would fix an issue where passing in bad user input often throws a non obvious error message. e.g. not including secretWordsOrPrivateKey throws cannot read property includes of undefined

Describe the solution you'd like.

Validate user input before running synpress

Describe alternatives you've considered.

Typescript partially fixes this problem but zod gives the runtime safety too

Additional context

No response

roninjin10 avatar Sep 10 '23 08:09 roninjin10