Skip to content

Errors moving from jest to vitest #745

@IanGraingerGMSL

Description

@IanGraingerGMSL

Describe the bug A clear and concise description of what the bug is.

When trying to move from jest to vitest, (using just mockAllIsIntersecting(false);) I get an error:

TypeError: (cb, options = {}) => {
    var _a, _b, _c;
    const item = {
      callback: cb,
      elements: /* @__PURE__...<omitted>... } is not a constructor

I tried to add setupIntersectionMocking(vi.fn()); before mockAllIsIntersecting but then get TypeError: IntersectionObserver is not a constructor.

Versions:

  • Version 9.13.1
  • Vitest 4.0.17
  • testing-library/react 16.3.0

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