Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information