Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@std/expect: provide message to expect #6345

Open
dandv opened this issue Jan 12, 2025 · 0 comments
Open

@std/expect: provide message to expect #6345

dandv opened this issue Jan 12, 2025 · 0 comments

Comments

@dandv
Copy link
Contributor

dandv commented Jan 12, 2025

Is your feature request related to a problem? Please describe.

expect failure messages like "error: AssertionError: Expected 0 to be greater than 0" could be more informative. The ability to add a failure message to the expect would be very useful, and many testing libraries allow supplying a custom message for a given expectation.

Demand for this feature can be seen at
https://stackoverflow.com/questions/45348083/how-to-add-custom-message-to-jest-expect.

Describe the solution you'd like

From the jest-expect-message library:

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

Describe alternatives you've considered

@std/assert doesn't mention any message capabilities either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant