Open NaveenNeti opened 3 weeks ago
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
I'll check this later.
Thank you @eryue0220 I will test this tomorrow 🙏
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 matchersWould be keen to help provide an MR to add support for it assuming the project owners see value.
Versions