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: spyOn should not rely on hasOwnProperty from the spied object #11721

Merged
merged 3 commits into from Aug 16, 2021

Commits on Aug 4, 2021

  1. fix: spyOn should not rely on hasOwnProperty from the spied object

    The `spyOn` function uses `hasOwnProperty` from the spied object, but this method can be unavailable,
    for example if the object has the `null` prototype, or if it is a proxy that filters some keys.
    
    This arises in Vue 3 projects where the proxies returned by the framework do not expose all methods,
    and forces the testing library to manually patch the proxies with `hasOwnProperty` to let Jest do its work
    https://github.com/vuejs/vue-test-utils-next/blob/23d3d3e1f4178a87de5023f5255e0623653affdc/src/mount.ts#L493-L495
    
    This commit changes the code to use `Object.prototype.hasOwnProperty` and fixes this issue.
    cexbrayat committed Aug 4, 2021
    Copy the full SHA
    d614bb1 View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2021

  1. Update CHANGELOG.md

    SimenB committed Aug 16, 2021
    Copy the full SHA
    87756cc View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    c859576 View commit details
    Browse the repository at this point in the history