/ core Public
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runtime-core): allow spying on proxy methods (#4216)
Since Jest v26.6.1, the mock method changed (see this commit facebook/jest@30e8020) to rely on `Object.defineProperty` in some cases. This breaks spying on proxy's methods, because even if Jest is properly calling `Object.defineProperty`, the cached value in the `get` section of the proxy is never updated, and the spy is in fact never used. This is easily reproducible as vue-next already uses a version of jest with these changes. This is blocking projects (like vue-test-utils-next and vue-cli) to update to recent Jest versions. This commit adds a `defineProperty` method to the proxy handler, that properly updates the defined value in the cache.
- Loading branch information
Showing 2 changed files with 83 additions and 0 deletions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will lines 400 and 403 affect the logic between lines 421 and 429 @cexbrayat