Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
946 views

vitest.config.js: import { defineConfig, mergeConfig } from 'vitest/config' import viteConfig from './vite.config' export default mergeConfig( viteConfig, defineConfig({ test: { ...
Роман Василаки's user avatar
0 votes
1 answer
1k views

I'm using Vitest in my project and I'm trying to obtain a coverage report from the Vitest UI. I've followed the steps from the docs, but I'm getting the error "Coverage enabled but missing html ...
Jasperan's user avatar
  • 4,945
1 vote
1 answer
635 views

I am writing a test for a Select component using the shadcn/ui package. This component has some parts (such as selectable items) that are rendered inside a Portal. Because of this, I’m having trouble ...
EhsanKey_'s user avatar
3 votes
2 answers
6k views

With React project set up with Vite and run tests with Vitest v2.1.1, we might see the following issue with CSS files: TypeError: Unknown file extension .css for /path/to/css/file How can we resolve ...
MinhTC's user avatar
  • 515
0 votes
1 answer
2k views

i'm building a portfolio website, so i'm mocking some requests to show that i know how to handle it. Here's my "request": export const getTestimonials = async (): Promise<Testimonial[]>...
Lucas Sales's user avatar
0 votes
1 answer
789 views

I use yarn workspases and one of workspaces threw this error: file:///home/username/Projects/projectName/node_modules/tinypool/dist/chunk-E2J7JLFN.js:46 throw error; ^ Error [...
Илья Хоришко's user avatar
1 vote
1 answer
465 views

Since we can not use the hook useAppDispatch() within our test file, I wonder how can I spy on the returned instance. import * as redux from "@/core/context/redux/store"; ... it("test&...
MiguelG's user avatar
  • 471
0 votes
1 answer
624 views

I have been trying to mock my graphql-request with vitest. The request looks this way: const getTastyFruit = gql` query Fruit($id: String!) { fruit(id: $id) { shop { ...
Katharina Schreiber's user avatar
1 vote
0 answers
285 views

I have a React component that uses a simple hook from React Query. I'm creating unit tests with Vitest, and I need to verify if the component is being rendered with the correct information based on ...
heliosk's user avatar
  • 1,169
0 votes
1 answer
363 views

For my unit tests I create a fake window.location object. Here's the slightly simplified code: function getFakeLocation(getCurrentUrl: () => URL): Location { return { get ancestorOrigins(): ...
balu's user avatar
  • 3,916
2 votes
0 answers
141 views

As I was setting up my tests for the code, I got stuck that I can't fully understand. My vitest log asks me to put my button click inside an act(), but it breaks by doing so. I don't fully understand ...
Gabriel Sousa's user avatar
0 votes
0 answers
2k views

I'm encountering an issue with Vitest where it cannot find an element with role="button" and aria-label matching /open notifications/i, even though the element appears clearly in the debug ...
Tomás Benfica's user avatar
1 vote
1 answer
504 views

I instantiate a new web worker within one of my React components const MyComponent = () => { ... const worker = new Worker( new URL('../../../path/to/my-worker.ts', import.meta.url) ...
Joseph Beuys' Mum's user avatar
0 votes
1 answer
527 views

I have three files: use-user-info.ts user-info.tsx user-info.test.tsx I want to test the behaviour of the component UserInfo (exported from user-info.tsx). On my test file I mock the hook like this: ...
Julio Villanueva's user avatar
1 vote
1 answer
4k views

In package.json, I have upgraded Vite to its latest version - 5.4.0. But package-lock.json is still showing dependencies with its old version - esbuild latest version in npm registry is 0.23.0 but ...
Nikhil's user avatar
  • 131
1 vote
1 answer
354 views

I have a Cloudflare Worker that interacts with an R2 bucket containing several data files. I want to write tests for this, but since Vitest isolates the tests from the development bucket, I need to be ...
decisionmachine's user avatar
3 votes
0 answers
2k views

I'm using vite and vitest. vite.config.ts export default defineConfig({ plugins: [vue(), VueDevTools()], resolve: { alias: [ { find: '@', replacement: fileURLToPath(new ...
bluedot's user avatar
  • 31
1 vote
1 answer
369 views

The project is using Vue, Vitest and Vue Test Utils. I am new to UI unit testing and I need to test that when one function from composable is called, then the other function should have been called. ...
Vitalii Moholiuk's user avatar
6 votes
2 answers
1k views

I'm migrating our test suite from Jest to Vitest. All tests work except for a remaining few which result in this error: Module /home/d/code/frontend/node_modules/@mui/icons-material/esm/VisibilityOff....
Damian Green's user avatar
  • 7,595
0 votes
1 answer
206 views

I have this React component: import React, { useState, useEffect } from "react"; import { BrowserRouter } from "react-router-dom"; import "./App.css"; import Home from &...
Camden Tadhg's user avatar
1 vote
1 answer
590 views

Given a Vue 3 component <template> <input id="input" type="text" @focus="handleOnFocus($event)" /> </template> <script setup type="ts">...
mummybot's user avatar
  • 2,798
0 votes
1 answer
53 views

Im new to testing in React using vitest. Im trying to test component that not only displays data but also manipulate them using some type of util. This is very simple example with ReservationCard that ...
m_novak's user avatar
  • 149
0 votes
2 answers
368 views

I have a custom hook (useFetch), which I'm using inside a page to pass data into a <Products/> component. export default function App() { const { products, totalProducts, currentPage, ...
Matheus Oliveira Damião's user avatar
1 vote
1 answer
817 views

I'm trying to test a drag-and-drop of a file into a Vue component and right now I'm using Vitest but all the resources on drag-and-drop I found were only for using Jest to achieve that so: How to test ...
Alex's user avatar
  • 5,944
0 votes
1 answer
1k views

So we are in the middle of adding Vitest to an existing project that currently relies on Webpack for bundling our code. We are in the process of rewriting older jQuery code into React. Right now i'm ...
Showcaselfloyd's user avatar

1 2 3
4
5
19