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(runtime-core): allow spying on proxy methods #4216

Merged
merged 1 commit into from Feb 12, 2022

Commits on Dec 25, 2021

  1. fix(runtime-core): allow spying on proxy methods

    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.
    cexbrayat committed Dec 25, 2021
    Copy the full SHA
    c4c9903 View commit details
    Browse the repository at this point in the history