We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using expect(...).toMatchObject with complex objects, it's hard to see which property/properties caused the assertion to fail.
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", }
Describe the solution you'd like
The library could indicate which property did not match, at lease for the top-level properties (in this case, foo).
foo
Describe alternatives you've considered
assertObjectMatch and Jest do this, for all properties, including nested ones:
assertObjectMatch
But obviously, assertObjectMatch doesn't support matchers, so there's no easy workaround for this issue.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When using expect(...).toMatchObject with complex objects, it's hard to see which property/properties caused the assertion to fail.
Steps to Reproduce
Describe the solution you'd like
The library could indicate which property did not match, at lease for the top-level properties (in this case,
foo
).Describe alternatives you've considered
assertObjectMatch
and Jest do this, for all properties, including nested ones:But obviously,
assertObjectMatch
doesn't support matchers, so there's no easy workaround for this issue.The text was updated successfully, but these errors were encountered: