Skip to content

[Bug]: toEqual with URL not work on node v20 #14585

@bluelovers

Description

@bluelovers

Version

29.7.0

Steps to reproduce

toEqual with URL not work on node v20

https://codesandbox.io/p/sandbox/node-js-jest-example-forked-vr3sgv?file=%2Findex.spec.js%3A18%2C4

test("url", () => {
  let u1 = new URL(
    "https://robotizing.net/ipfs/QmTWsPwz1wrKSgpiKa5tyC3rWkWh3Kym6ikCSmwiGPsfqd",
  );
  let u2 = new URL(
    "https://robotizing.net/ipfs/QmTWsPwz1wrKSgpiKa5tyC3rWkWh3Kym6ikCSmwiGPsfqd",
  );

  u2.searchParams.set("filename", "7777.epub");

  console.dir({
	u1,
	u2,
  })

  expect(u1).not.toEqual(u2);
  expect([u1]).not.toEqual([u2]);
});

Expected behavior

no error

Actual behavior

image

Additional context

No response

Environment

FROM node:20-bullseye

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions