Questions tagged [vitest]

Vitest is a blazing-fast unit test framework powered by Vite.

501 questions
6
votes
1 answer

Fail to run Vitest test with an error: "Vitest caught 1 unhandled error during the test run"

I have a function which I try to test using Vitest. This is my function (I test the exported one): import os from 'node:os'; import { AI_COMMIT_IGNORED_FILES } from '../constants/ai-commit'; import { asyncExec } from './os'; /** * The function…
Tal Rofe
  • 457
  • 12
  • 46
6
votes
0 answers

Vitest config doesn't detect jsdom environment

I'm in a Vite/React/TypeScript application and I'm configuring my first test with Vitest. When I run my Button test (yarn vitest), I get this error: packages/frontend/src/components/Generic/Button/Button.test.tsx > Button > should render the…
tomakazub
  • 237
  • 1
  • 2
  • 8
6
votes
1 answer

nuxt3: how to test SSR page with form, useFetch() and pinia?

In my Nuxt3 project, I have a very basic login page which is SSR like the following: pages/login.vue