Skip to main content
Filter by
Sorted by
Tagged with
22 votes
7 answers
27k views

I have started to replace Jest with Vitest for my unit test library in my Vue 3 App. I am trying to write unit test for a component that uses the vue-i18n library to translate text within it but when ...
Mac's user avatar
  • 1,177
3 votes
1 answer
272 views

I have a Next.js app that is running without any errors. However, I am using Vitest for my testing framework and when running a specific test (layout.test.tsx) it produces this error: FAIL src/app/...
JoeTidee's user avatar
  • 26.3k
15 votes
1 answer
35k views

How do I get variables defined in my setup files to work in my test files? Setup files: var lol = 'lol' test: describe("test", () => { it("test lol", () => { expect(...
Harry's user avatar
  • 55.4k
9 votes
3 answers
19k views

I am using axios.create method to create and configure axios instance. And I can't get it to work in tests with vi.fn() so I cannot assert if endpoint was called. workaround for tests to be able to ...
IowA's user avatar
  • 1,116
6 votes
1 answer
14k views

I am running a vue3 application using the Composition API and the setup() hook. I am using Vitest as unit-test framework. (v 0.6.1) I have the following sample component : // src/components/...
Deltantoine's user avatar
0 votes
0 answers
247 views

I want to write tests for the following function using Vitest. import { randomUUID } from "node:crypto"; export const getRandomUUID = (): string => { return randomUUID(); } I wrote ...
qqq_ts_react's user avatar
26 votes
4 answers
33k views

I'm starting out with Vite for a React application but unable to get jest tests working. I am trying to use Vitest with experimental ES module. I am getting: FAIL src/App.test.tsx [ src/App.test.tsx ]...
Michael Durrant's user avatar
11 votes
0 answers
3k views

I am using Vitest for Vue Unit Testing and I am currently faced with this error: FAIL tests/unit/components/MyComponent.spec.js [ tests/unit/components/MyComponent.spec.js ] SyntaxError: At least one ...
Jessica's user avatar
  • 634
8 votes
1 answer
28k views

I have a very basic test, however it throws the error below when I try to mount a component const wrapper = mount(HomeHeader). I've pasted my vite config, test, component and packages. This error ...
Leon Gaban's user avatar
  • 39.4k
7 votes
1 answer
7k views

I'm trying to run an azure devops pipeline that contains a vitest run with coverage. The issue is that the azure coverage collector plugin accepts only jacoco/cobertura formats. I've seen that for ...
QuickQuestion's user avatar
6 votes
1 answer
3k views

I am currently using Vite with Vitest to perform unit testing for my React components. However, I am encountering an issue where the Tailwind CSS classes applied to my components are not being ...
Space's user avatar
  • 137
6 votes
5 answers
6k views

I have been killing myself trying to figure out how to test a Vue component with a v-dialog, something which worked perfectly fine in Vue2. Currently I am using Vue3, Vitest, Vuetify3. here is a very ...
Andrey's user avatar
  • 478
4 votes
1 answer
2k views

imagine we have two components, Modal.vue which is lets say a component that is used to display modal content (uses slots to take in JSX), and Component.vue which is the one with content we wish to ...
ReMo's user avatar
  • 133
4 votes
2 answers
8k views

I am trying to set up testing for my React app using Vitest, but I am experiencing an error which must be due to some missing dependency or error in my test suite. I'm unsure what exactly is the cause....
A-PSquestions's user avatar
3 votes
1 answer
5k views

I have built a ReactJS application using Vite, and I am testing my application using Vitest. I make heavy usage of react-query within my application. For mocking network requests during testing, I ...
pooley1994's user avatar
  • 1,023
2 votes
0 answers
2k views

I would render my vitest coverage in Azure DevOps UI, I've tried to follow tutorials but it doesn't work: I tried to setup PublishCodeCoverageResults to publish the cobertura xml file as in below: ...
gio's user avatar
  • 911
1 vote
1 answer
5k views

My application requires a very extensive loading for certain functions, but vite updates the page by itself causing the loading to restart and lose all the progress already made on the page, I would ...
ElidianneFr's user avatar
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
0 votes
1 answer
7k views

I have a component written in Vue 3 and script setup. Now I am trying to write a unit test for it, where I am instantiating a spy to check whether a function has been called. I read somewhere that ...
Ricardo de Vries's user avatar
-2 votes
1 answer
858 views

Probably less important: Setup is done with webpack Encore which generates a webpack config file, we use yarn as a package manager, so vitest is installed with yarn. jQuery version 3.6.4 vitest ...
goulashsoup's user avatar
  • 3,236