Skip to content
New issue

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

fix: comparing different URL objects now return false #14672

Merged
merged 5 commits into from
Nov 3, 2023
Merged

fix: comparing different URL objects now return false #14672

merged 5 commits into from
Nov 3, 2023

Conversation

tr1ckydev
Copy link
Contributor

Summary

Previously, jest would report this test as PASS.

test('url test', () => {
    expect(new URL("https://jestjs.io/")).toEqual(new URL("https://jestjs.io/docs/getting-started"));
});

In this pull request, this gets fixed and jest properly compares the two URL objects and reports FAIL.

Test plan

test('url test', () => {
    expect(new URL("https://jestjs.io/")).toEqual(new URL("https://jestjs.io/"));
});
// Results in PASS.
test('hash test', () => {
    expect(new URL("https://jestjs.io/docs/getting-started")).toEqual(new URL("https://jestjs.io/docs/getting-started#using-babel"));
});
// Results in FAIL.

Copy link

linux-foundation-easycla bot commented Nov 2, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Nov 2, 2023

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ae12c6c
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/6543c260ce51fe0008d7e760
😎 Deploy Preview https://deploy-preview-14672--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! can you include tests and a changelog entry? 🙂

@tr1ckydev tr1ckydev requested a review from SimenB November 2, 2023 12:55
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff, thanks! Can merge as soon as the CLA is signed 🙂

@tr1ckydev
Copy link
Contributor Author

Done now!

@SimenB SimenB enabled auto-merge (squash) November 2, 2023 13:27
auto-merge was automatically disabled November 2, 2023 15:38

Head branch was pushed to by a user without write access

@SimenB SimenB merged commit 6cbba98 into jestjs:main Nov 3, 2023
73 checks passed
@SimenB
Copy link
Member

SimenB commented Nov 16, 2023

Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: toEqual with URL not work on node v20 [Bug]: Jest reports different URL objects as PASS.
2 participants