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 toMatchObject shows "expected... to NOT match" #6224

Open
dandv opened this issue Dec 2, 2024 · 0 comments · May be fixed by #6228
Open

expect toMatchObject shows "expected... to NOT match" #6224

dandv opened this issue Dec 2, 2024 · 0 comments · May be fixed by #6228
Labels
bug Something isn't working

Comments

@dandv
Copy link
Contributor

dandv commented Dec 2, 2024

Describe the bug
If the assertion fails, expect(actual).toMatchObject(expected) shows that it expected actual "to NOT match" [sic]:

Steps to Reproduce

import { it } from '@std/testing/bdd';
import { expect } from '@std/expect';

const expected = {
  field1: 'abc',
  field2: 'def',
  foo: 'bar',
}

it('toMatchObject', () => {
  expect({ 
    field1: 'abc',
    field2: 'def',
    foo: 'baz',
  }).toMatchObject(expected);
});
$ deno test denobug.test.ts 
running 1 test from ./denobug.test.ts
toMatchObject ... FAILED (2ms)

 ERRORS 

toMatchObject => https://jsr.io/@std/testing/1.0.5/_test_suite.ts:218:10
error: AssertionError: Expected {
  field1: "abc",
  field2: "def",
  foo: "baz",
} to NOT match {
  field1: "abc",
  field2: "def",
  foo: "bar",
}

Expected behavior

The output should omit NOT .

Environment

  • OS: Fedora Linux
  • deno version: 2.1.2
  • std version: not sure what to put here? @std/testing is at 1.0.5, expect at 1.0.8
@dandv dandv added bug Something isn't working needs triage labels Dec 2, 2024
@kt3k kt3k removed the needs triage label Dec 2, 2024
@IgorM867 IgorM867 linked a pull request Dec 2, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants