ealush / vest

Vest ✅ Declarative validations framework

Home Page:https://vestjs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pending info in summary

vonagam opened this issue · comments

Would be convenient to have info about pending tests in summary - it can be pendingCount: number or pending: boolean on suite overall and specific fields. That will allow to add "pending" selector to parser and classnames utils.

Is this possible to implement or are there any clear obstacles to this?

Hey @vonagam, thanks for this suggestion.
Yes, this does make absolute sense, and is also not a great lift. Look like a little change to https://github.com/ealush/vest/blob/latest/packages/vest/src/suiteResult/selectors/produceSuiteSummary.ts#L22

The thing is that test summary is on the field level, if we have multiple fields, we have to clearly indicate it could be partial (like, some tests are pending and some are done).

We could be VERY explicit, and say:

pending: number (pending: 2)

But we could also be a little more relaxed and say something like:
hasPending: boolean

Support would probably only come on v5, but that's pretty obvious.

One thing that I'll say is - I am planning to add a few more async capabilities to Vest, and we need to make sure whatever we land on will play nicely with that too. These new async features will be outside of a single test, but an actual portion of the suite in order to allow server-validation to communicate with client-validation. I'll have to iterate on it.

For naming, I think it should be pendingCount if it is a number to match errorCount, warnCount and testCount, or pending if it is a boolean to match valid.

If it is a number to make it consistent it have to be a sum of pendingCount from all fields (so number would mean "number of pending tests" and not "number of pending fields", though if async tests for a field are eager and sequential it is the same thing).

if we have multiple fields, we have to clearly indicate it could be partial (like, some tests are pending and some are done).

Ye, that's the same with current counters or valid. If you want to know overall state look at the top level, if you want for a specific field check tests[fieldName].

Ran a quick first iteration based on this thread. Might need a second pass, but let me know if this is somewhat helpful: #1067

Should be released under: vest@5.0.0-next-20230905-5c95

Looks perfect, big thanks.

awesome. added a few more tests and merged. Let me know if there are any usability issues there.

Cool, I'll close the issue, will report if something comes up (I assume it won't).