vitest-dev / vitest

Next generation testing framework powered by Vite.

Home Page:https://vitest.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a reason parameter in expect

MisterLight opened this issue · comments

commented

Clear and concise description of the problem

Just a little message can help to document the thing under test, thats why in some testing libraries is possible to supply a custom message for a given expectation.

Coming from Jest I was capable of doing this thanks to this library:

jest-expect-message

But I think it would be great if vitest come with it natively

Suggested solution

Using the same code from the mentioned library before:

test('returns 2 when adding 1 and 1', () => {
  expect(1 + 1, 'Woah this should be 2!').toBe(3);
});

Alternative

No response

Additional context

No response

Validations

It already has one.