Repository navigation
fix(expect): handle nullish toHaveProperty values (fix #10735) - #10811
Conversation
|
Hello @liyimil. Your PR has been labeled To keep your PR open, please follow these steps:
Please, do not generate or format the response with AI. If you do not speak English, reply in your native language or use translation software like Google Translate or Deepl. If the response is generated, the PR will be closed automatically. These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context. |
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
我读了Issue、相关评论和贡献规范,做出了这次修改,是我本人提的 |
|
我是真人,愿意为代码负责,使用了正确的模板,有一些代码是用codex辅助的 |
|
Hello @liyimil. Your PR has been labeled To keep your PR open, please follow these steps:
Please, do not generate or format the response with AI. If you do not speak English, reply in your native language or use translation software like Google Translate or Deepl. If the response is generated, the PR will be closed automatically. These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context. |
Description
toHavePropertycalledObject.hasOwnbefore validating its received value, sonullandundefinedleaked the runtime errorCannot convert undefined or null to object.This validates nullish inputs first and reports a matcher-specific
TypeErrorfor both regular and negated assertions. The regression test coversnullandundefinedin all four cases.Resolves #10735
Codex was used as a personal assistant for this contribution. The issue, implementation, diff, and local validation were reviewed before submission.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.CI=true pnpm -C test/unit test --run test/jest-expect.test.ts(342 passed, 27 expected failures across threads, vmThreads, and forks)pnpm typecheckpnpm buildpnpm lint:fixDocumentation
Changesets