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
Thank you to all for the work on this project.
The JSR page for @std/expect states "Jest compatible expect assertion functions"
expect
While trying to use toMatchObject I noticed it doesn't seem to support asymmetric matchers similar to what jest would allow.
toMatchObject
e.g. within Jest
expect({ position: { x: 0, y: 0 } }).toMatchObject({ position: { x: expect.any(Number), y: expect.any(Number) } });
Running the same test in Deno:
Deno.test("CustomMatcher tests", () => { expect({ position: { x: 0, y: 0 } }).toMatchObject({ position: { x: expect.any(Number), y: expect.any(Number), }, }); });
Results in the output:
error: AssertionError: Values are not equal. [Diff] Actual / Expected { position: { + x: { + value: [Function: Number], + }, + y: { + value: [Function: Number], + }, - x: 0, - y: 0, }, }
Describe the solution you'd like
Would be keen to help provide an MR to add support for it assuming the project owners see value.
Versions
deno: 2.0.0 @std/assert/1.0.6
The text was updated successfully, but these errors were encountered:
I'll check this later.
Sorry, something went wrong.
expect.toMatchObject
Thank you @eryue0220 I will test this tomorrow 🙏
Confirmed this is fixed @eryue0220 Thank you.
No branches or pull requests
Thank you to all for the work on this project.
The JSR page for @std/expect states "Jest compatible
expect
assertion functions"While trying to use
toMatchObject
I noticed it doesn't seem to support asymmetric matchers similar to what jest would allow.e.g. within Jest
Running the same test in Deno:
Results in the output:
Describe the solution you'd like
toMatchObject
would have consistent behavior with jest and allow for asymmetric matchershttps://jsr.io/@std/expect/1.0.5/_matchers.ts#L461
https://jsr.io/@std/expect/1.0.5/_matchers.ts#L487
Would be keen to help provide an MR to add support for it assuming the project owners see value.
Versions
The text was updated successfully, but these errors were encountered: