Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
2k views

I am writing tests with Vitest and Vue Test Utils, but I am having a problem with one of the tests where I want to test the invocation of my reflectInput function when text is typed into the input. ...
guilherme augusto's user avatar
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
6 votes
1 answer
8k views

i'm learning Vue 3 using composition api, and im very new to Vitest aswell (i know it uses Vue Test Utils though). So, in short i'm having a problem where I mock the Vue Router, trigger click on a ...
Davidhdm's user avatar
4 votes
1 answer
3k views

Unit test vue component by mocking methods using vitest. MyComponent.vue <script setup> import { ref } from "vue"; const isSelectAll = ref(true); const selectAllModel = ref(false); ...
Ihsahs's user avatar
  • 902
3 votes
0 answers
1k views

I want to test that my "UploadFilesComponent" enables the user to: Upload a file for later use Emits that file to the root component Using Vue-Utils and vitest I came up with the test ...
Martin Müsli's user avatar
1 vote
1 answer
2k views

I'm using Vue3 and Vue Test Utils in my unit tests and was successfully until arrived to this component with two slots inside, a default and a title (it's a copy and paste from the UIDisclosure ...
Daniele Tentoni's user avatar
3 votes
2 answers
2k views

I am currently trying to write a test using vitest/vue-test-utils for an app which uses vuetifyjs 3. My issue currently is I am unable to set values through the v-select and v-autocomplete component (...
muffinhydra's user avatar
0 votes
2 answers
2k views

I got a form in a nuxt 3 app with three input fields. Here is how the submit function looks like: const submitForm = async () => { try { await $fetch("/api/contact", { ...
hatja's user avatar
  • 141
0 votes
1 answer
737 views

For testing, if a list is correctly rendered from an array prop I need to loop through the created items and see if inside data are ok. But I can't use querySelectorAll. The problem is I can't use ...
Ari Shojaei's user avatar
5 votes
0 answers
1k views

I am using Nuxt 3 on the current project at work. We just started writing tests (this is my first time doing that). I'm trying to test a component which has Nuxt useRouter and my basic test fails ...
AirKlisa's user avatar
  • 143
1 vote
1 answer
2k views

I use Vue.js 3, setup syntax, typescript and vue-i18n. For the testing I use vitest and Vue Testing Library. I try to mock i18n's t function, but looks like component doesn't see it. How can I solve ...
Explicit's user avatar
  • 449
1 vote
1 answer
101 views

This is fragmented/fantasy code to describe only the relevant passages tests/my-component.spec.js import { shallowMount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; import ...
rammi22's user avatar
  • 399
0 votes
1 answer
271 views

My component test failed by commit to a custom state store with: [vuex] module namespace not found in mapState(): MyComponentStore/ The component itself works as expected. The codes: tests/myComponent....
rammi22's user avatar
  • 399
0 votes
1 answer
53 views

I have a vue.JS component in which, when mounted, executes a function getIngredients : mounted() { if (this.cocktail) { this.getIngredients(); } } I have a unit test that won't pass : it('...
ChillAndCode's user avatar
0 votes
0 answers
77 views

report.api.js: export var reportAPI = (function() { function getIsProjectLeader() { .... } return { getIsProjectLeader: getIsProjectLeader }; } workerReportForm.vue: created() { ...
farahm's user avatar
  • 1,356
0 votes
1 answer
1k views

I want to test if "onLogin" event emitted from child component will trigger "toLogin" function from parent correctly. Login.vue <template> <ChildComponent ref="...
Joshua Yu's user avatar
2 votes
0 answers
4k views

I want to migrate jest unit tests from vue 2 to vue 3. But I'm stuck with mocking up computed props. I got a lot of vue-2 unit tests written like this: const wrapper = shallowMount(FooComponent, { ...
eXception's user avatar
  • 2,419
5 votes
0 answers
2k views

I am trying to create a unit test that covers this portion of my Vue component code. const length = ref(sizes.value[0] ? sizes.value[0].value : 0) watch( () => length.value, (newLength: number) ...
Xeyos's user avatar
  • 91
0 votes
1 answer
640 views

I'd like to mock the route object to prevent test failures like TypeError: Cannot read properties of undefined when accessing route.x. I tried: const route = { fullPath: '/', path: '/' }; const ...
leonheess's user avatar
  • 22.3k
1 vote
1 answer
352 views

We have two vue3 projects. Project 1 has some components that use components from Project 2 as imported dependencies. In Project 1, MyComponent.vue: <template> <Project2Modal> Some html ...
CatDev's user avatar
  • 11
4 votes
1 answer
8k views

I am trying to simulate choosing an option in a <select> element in my Vitest test. The simulated selection should set the value of the ref that is bound to the <select>'s v-model. As you ...
Shoptimizer's user avatar
2 votes
1 answer
1k views

I started to learn testing, but have not yet achieved much success in this. I'm trying to write a mock test for a component, but I'm getting an error Test suite failed to run Cannot find module '...
Eugen's user avatar
  • 23
2 votes
0 answers
661 views

I have a very basic component called ConfirmModal.vue <template> <el-dialog v-model="dialogVisible" :title="title" width="30%"> <span>{{ content }}...
Utpal Sarkar's user avatar
0 votes
0 answers
458 views

Im trying to check if a function is being call when resize event fired. "@vue/test-utils": "^1.3.3" "vue": "^2.7.14" "jest": "27.1.0" ...
Julieta's user avatar
  • 43
4 votes
2 answers
6k views

sitting on a issue here. ever used typescript + vue-test-utils and tried to manipulate a value for the test like: wrapper.vm.aCoolRefValueToManipulate = 'something much cooler'? well i tried. and it ...
Deniz's user avatar
  • 1,488

1
2
3 4 5
17