Skip to content

Does not recognise Vitest 2 inside beforeAll hook #689

@RobinTail

Description

@RobinTail

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

When trying to upgrade Vitest from 1.6 to 2.0 I'm getting these warnings:

React Intersection Observer was not configured to handle mocking.
Outside Jest and Vitest, you might need to manually configure it by calling setupIntersectionMocking() and resetIntersectionMocking() in your test setup file.

// test-setup.js
import { resetIntersectionMocking, setupIntersectionMocking } from 'react-intersection-observer/test-utils';

beforeEach(() => {
  setupIntersectionMocking(vi.fn);
});

afterEach(() => {
  resetIntersectionMocking();
});

To Reproduce Try and recreate the issue in a Codesandbox:

none yet

Expected behavior A clear and concise description of what you expected to
happen.

Should detect Vitest 2 similar to Vitest 1.6

Additional context Add any other context about the problem here.

Running latest version, 9.10.3

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