-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
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 jestjs/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 are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8457d8b
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