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: auto-mock based on descriptor list, not property keys (fix #1671) #1782

Closed

Commits on Aug 4, 2022

  1. fix: auto-mock based on descriptor list, not property keys (fix vites…

    …t-dev#1671)
    
    These two methods seem like they should be the same, but they're not.
    Some objects, especially native Node exports, behave strangely; they
    have properties that are enumerated by `Object.getOwnPropertyNames()`
    and/or `Object.getOwnPropertySymbols()`, but when you try to get the
    descriptor for that property using `Object.getOwnPropertyDescriptor()`
    it returns `undefined`. To combat this, instead of getting the property
    names / symbols manually, we instead offload that work to the JS engine
    itself via `Object.getOwnPropertyDescriptors`, and just iterate through
    the result.
    
    Fixes vitest-dev#1671
    simon-abbott committed Aug 4, 2022
    Configuration menu
    Copy the full SHA
    8bf0540 View commit details
    Browse the repository at this point in the history