ealush / vest

Vest ✅ Declarative validations framework

Home Page:https://vestjs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stateless suite

piotrpalek opened this issue · comments

👋 I'm using Vest v4, is there any way to have a "stateless" suite? I want to pass an object and validate it from a fresh state each time, without having to worry about calling reset at the right time.

Hey, thanks for reaching out.

Just so you know, the V4 docs are still available on the site.

Here's the relevant page:

https://vestjs.dev/docs/4.x/understanding_state#server-side-validations

See the section: Server Side Validations

Basically, all you need to do is wrap the suite creation and execution with a function and you're done. Each call will create a new suite, ignoring past runs.

I hope that helps.

somehow missed that in the docs, thanks for the quick response!