919 questions
8
votes
1
answer
29k
views
vitest test await async completion of onMounted callback in vue3 component
I'm playing around with Vitest and want to wait for the completion of a couple mocked fetches in the onMounted lifecycle hook in my component:
My test:
import { mount } from '@vue/test-utils';
import ...
6
votes
1
answer
14k
views
Vue3- Using Vitest toHaveBeenCalled() method
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/...
0
votes
1
answer
1k
views
Adding Props to found components throw the mounted wrapper
I have a form that contains a selector reusable component like this
<template>
<div class="channelDetail" data-test="channelDetail">
<div class="row"&...
1
vote
1
answer
5k
views
React vitest innerHTML toEqual
I'm trying to test a React node with React, Vitest and Testing Library, but the formatting from the innerHTML makes it not match. How I can avoid the formatting for testing cases?
- Expected - 3
+...
2
votes
1
answer
1k
views
Cannot find module 'react' when use third party React UI lib - Vite + Preact
I'm facing this issue in this Vite started repository.
https://github.com/vicainelli/vite-starter
I'm using Vite + Preact + Vitest + Testing Library
If I'm testing any code inside the codebase, it ...
1
vote
2
answers
3k
views
Vue3 testing ElementPlus controls with vitest
I am running Vue3 with vite and can't write any tests for components that use the ElementPlus library. Something else needs to be injected apparently but I don't know how to do that.
I have the ...
0
votes
0
answers
5k
views
Why does vitest mock not catch my axios get-requests?
I've been trying out vitest, but I've gotten stuck when i tried to run tests on a component that utilizes the PokeAPI. I figured creating a mock setup would fix it, but to no avail.
The component that ...
3
votes
1
answer
5k
views
Vitest integration with Quasar
I have been trying to integrate Vitest with a project that implements Quasar but I have not succeed doing so. The main problem that I am facing when testing is that quasar components are not rendering ...
13
votes
2
answers
15k
views
How to keep tests outside from source directory in Vite projects?
Running npm init vue@latest with the following setup
generates a Vitest spec file inside the src directory. I'm wondering why Cypress e2e tests have a seperate directory and Vitest unit tests are ...
1
vote
0
answers
312
views
import { takeCoverage } from 'v8'
Just created a local project using npm init vue@3 using the option vitest. After installing the packages when executing cmd yarn test:unit it throws following errors:
$ yarn test:unit
yarn run v1.22....