Skip to content

react-test-renderer: is possible to test lifecycle functions? #13487

@FabricioFFC

Description

@FabricioFFC

Do you want to request a feature or report a bug?

Question

What is the current behavior?

I am trying to use react-test-renderer and I notice that the lifecycles methods (ex: componentDidMount) need to be fired manually - rendered.getInstance().componentDidMount(), what solves my problem but reveals an other: I want to use shallow render, to test only the component under test, but then react-test-renderer/shallow API is minimal for rendering.

What is the expected behavior?

I was expecting that react-test-renderer would support testing my component reaction to the different lifecycles and be capable to use shallow rendering. Is there some way to use react-test-renderer in this scenario? Or is better I move to another library like enzyme?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions