WebStorm can't run Vitest anymore

66 Views Asked by At

Just a few days ago, I stopped being able to use Vitest run configs in WebStorm. i.e., pressing the little Play button gives me errors, which vary based on the test file.

I think this may have something to do with a changed config, which it is hard to track down, and I think it has something to do with our NX monorepo structure.

Maybe some of the errors may be helpful.

From a simple test file that just tests plain TS functions:

ReferenceError: describe is not defined

From a test file that calls vi.mock:

Error: There are some problems in resolving the mocks API.

You may encounter this issue when importing the mocks API from another module other than 'vitest'.

From a file that imports '@testing-library/jest-dom'

ReferenceError: expect is not defined

I can't exactly characterize this file, but I think the distinction is that its imports reference a sibling nx library (@member/config)

Error: Failed to load url @member/config (resolved id: @member/config) in /Users/.../tests/YourBoxTestPage.tsx. Does the file exist?

0

There are 0 best solutions below