oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.23k stars 2.77k forks source link

[Jest] Diff is incomplete when using `toStrictEqual` to compare URL #7253

Open Hanaasagi opened 11 months ago

Hanaasagi commented 11 months ago

What version of Bun is running?

1.0.13+f5bf67bd1

What platform is your computer?

Linux 6.6.2-arch1-1 x86_64 unknown

What steps can reproduce the bug?

it("test", () => {
  const url1 = new URL("https://www.google.com");
  const url2 = new URL("https://github.com");
  expect(url1).toStrictEqual(url2);
});

What is the expected behavior?

show the diff

What do you see instead?

>>​ bun test test/x.test.js
bun test v1.0.13 (f5bf67bd)

test/x.test.js:
1 | it("test", () => {
2 |   const url1 = new URL("https://www.google.com");
3 |   const url2 = new URL("https://github.com");
4 |   expect(url1).toStrictEqual(url2);
      ^
error: expect(received).toStrictEqual(expected)

  {}

- Expected  - 0
+ Received  + 0

Additional information

No response

Hanaasagi commented 11 months ago

https://github.com/oven-sh/bun/blob/22818e6806cfff66804a74bdbd71f90d195f8183/src/bun.js/bindings/exports.zig#L2963-L2964 https://github.com/oven-sh/bun/blob/22818e6806cfff66804a74bdbd71f90d195f8183/src/bun.js/bindings/bindings.cpp#L4425

const url = new URL("https://www.google.com");
console.log(Object.getOwnPropertyNames(url));  // []