Skip to content

Commit

Permalink
patch(vest): Always call done on suite run finish
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Oct 2, 2023
1 parent ca735df commit e889bd7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
20 changes: 18 additions & 2 deletions packages/vest/src/suiteResult/done/__tests__/done.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,30 @@ describe('done', () => {
});

describe('When no tests are run', () => {
it('Should avoid calling the callback', () => {
it('Should run the callback', () => {
const cb = jest.fn();

const suite = vest.create(() => {});

suite().done(cb);

expect(cb).not.toHaveBeenCalled();
expect(cb).toHaveBeenCalled();
});

describe('When tests are omitted', () => {
it('Should run the callback', () => {
const cb = jest.fn();

const suite = vest.create(() => {
vest.optional({ f1: true });

vest.test('f1', () => {});
});

suite().done(cb);
expect(suite.get().tests.f1.testCount).toBe(0);
expect(cb).toHaveBeenCalled();
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function shouldSkipDoneRegistration<
// If we do not have any test runs for the current field
return !!(
!isFunction(callback) ||
numberEquals(output.testCount, 0) ||
(fieldName && numberEquals(output.tests[fieldName]?.testCount ?? 0, 0))
);
}

2 comments on commit e889bd7

@vercel
Copy link

@vercel vercel bot commented on e889bd7 Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest – ./website

vest.vercel.app
www.vestjs.dev
vest-git-latest-ealush.vercel.app
vestjs.dev
vest-ealush.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e889bd7 Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest-next – ./website

vest-next-git-latest-ealush.vercel.app
vest-next.vercel.app
vest-website.vercel.app
vest-next-ealush.vercel.app

Please sign in to comment.