Skip to content

does not work with vitest because vitest does not define fit() #330

@querry43

Description

@querry43

Describe the bug

When testing with vitest, fit is not defined. jestPreviewConfigure throws when it tries to override fit.

ReferenceError: fit is not defined
 ❯ autoRunPreview ../node_modules/jest-preview/dist/index.js:479:7
    477|   it = itWithPreview;
    478|   test = itWithPreview;
    479|   fit = itWithPreview.only;
       |       ^
    480| }
    481|
 ❯ Proxy.jestPreviewConfigure ../node_modules/jest-preview/dist/index.js:397:5

Screenshots

Reproduce

  1. Undefine fit or create a react project using vitest.
  2. Run a test with a preview.

Expected behavior

Tests do not throw.

Environment (please complete the following information)

  • OS: macOS 26.2
  • Node v20.19.5
  • Browser: N/A
  • Vitest version: vitest/3.1.2 darwin-arm64 node-v20.19.5

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions