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

expect's customMessage not working for all matchers #6206

Open
lcrespilho opened this issue Nov 22, 2024 · 0 comments
Open

expect's customMessage not working for all matchers #6206

lcrespilho opened this issue Nov 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@lcrespilho
Copy link

Describe the bug
The customMessage parameter of expect module is not working for all matchers. For instance, it doesn't work for toBeGreaterThan matcher.

Steps to Reproduce

  1. Create a file named demo_test.ts with these contents:
import { expect } from 'jsr:@std/expect'

Deno.test('mytest', () => {
  expect(1, 'My Custom Message').toBeGreaterThan(2)
})
  1. Execute this command on the terminal to run the test:
    deno test

  2. The output contains:

mytest => ./demo_test.ts:3:6
error: AssertionError: Expected 1 to be greater than 2
      throw new AssertionError(
            ^

Expected behavior

The output should include the customMessage parameter, like:

mytest => ./demo_test.ts:3:6
error: AssertionError: Expected 1 to be greater than 2: My Custom Message
      throw new AssertionError(
            ^

Environment

  • OS: MacOS 15.1.1 Sequoia
  • deno version: 2.1.1
  • @std/assert version: 1.0.8
@lcrespilho lcrespilho added bug Something isn't working needs triage labels Nov 22, 2024
@kt3k kt3k removed the needs triage label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants