ealush / vest

Vest ✅ Declarative validations framework

Home Page:https://vestjs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Done and empty suite

vonagam opened this issue · comments

If we have this:

const vest = require("vest")

const suite = vest.create(() => {
  vest.test("foo", () => {});
});

const result = suite();

result.done(() => {
  console.log("done");
});

We will see "done" being printed.

Now, if we add vest.optional({foo: true}) before vest.test or remove vest.test altogether then the suite will run but there will be no done call.

In my use case it was something like vest.optional({name: data.name === current.name}) to avoid running tests on a name field unless it was changed.

I think you are right. Unless targeting specifically a nonexistent fieldname (eg: .done('bla', () => {...})), done should always run at the end of the suite, even if it turned out to be empty, or without any tests actually running. Let me sort it out one moment.

There you go. vest@5.1.1 should have it fixed.
e889bd7

Thanks!