Thanks to visit codestin.com
Credit goes to github.com

Skip to content

spyOn property with accessType does not work for instances of a Class #5746

@nc-lot

Description

@nc-lot

Do you want to request a feature or report a bug?
Feature for spyOn to work with objects that have getters/setters on the prototype chain.

What is the current behavior?
Does not support spying on getters/setters on the object's prototype chain.

If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install and yarn test.

I have recreated this issue in this repl.
https://repl.it/@functionator/spyOn-getter

What is the expected behavior?
Should be able mock getters/setters on the object's prototype chain.

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

jest: v22.1.0
npm: 5.6.0
node: v9.3.0
os: Mac High Sierra v10.13.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions