Skip to content

"ResizeObserver is not defined" error when running Jest #40

Closed
@remidej

Description

@remidej

Hello 👋

Using useResizeObserver crashes my app's tests. Jest uses JSDom, which apparently doesn't support the ResizeObserver API.

I know we can detect when Jest is running, but React doesn't support conditionally calling hooks, so I don't know how to prevent Jest from crashing. I think the fix has to be done inside the hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions