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

Use .toHaveProperty to check for property #16296

Merged
merged 1 commit into from Feb 21, 2024

Conversation

nicolo-ribaudo
Copy link
Member

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Fixes the CI failure in #16294 (that is actually also failing on main, we just didn't trigger CI yet)

expect@30.0.0-alpha.3 was recently released, with a change that causes expect(notAnIterable).not.toContain(foo) to throw rather than passing because notAnIterable does not contain anything so it doesn't contain foo (jestjs/jest@bd3a7e9).

Our CI somehow pulls in not only the latest stable version of packages, but the latest version in general and so it uncovered this bug in our tests.

@SimenB I don't think this change was intentional, but maybe it would be great to have it documented in the 30.0.0 release notes :)

@nicolo-ribaudo
Copy link
Member Author

Also @liuxingbaoyu pleae take a look at the REPL job failure :)

@SimenB
Copy link
Contributor

SimenB commented Feb 21, 2024

That was most definitely not on purpose! 😅 Might be kinda correct, though? not sure 🤔 do you have a minimal reproduction?

@nicolo-ribaudo
Copy link
Member Author

@SimenB I think the new beahvior better than the old one :) expect({}).not.toContain(1) passes in 29 and throws in 30.

@nicolo-ribaudo nicolo-ribaudo merged commit 458937c into babel:main Feb 21, 2024
49 of 50 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the fix-main branch February 21, 2024 15:05
@SimenB
Copy link
Contributor

SimenB commented Feb 21, 2024

cool 👍 will leave it be, then 🙂 unless the error message is bad?

@nicolo-ribaudo
Copy link
Member Author

The error message is terrible (it always just says received is not iterable), but probably it's ok since it should only happen with wrong input to expect.

liuxingbaoyu pushed a commit to liuxingbaoyu/babel that referenced this pull request Mar 5, 2024
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Fixes failing main
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants