Questions tagged [vue-test-utils]

Helpers to render VueJS components in unit tests.

Toolset to make complete or shallow rendering VueJS components while writing unit tests. Can be run under Jest or Mocha test runners. See vue-test-utils.vuejs.org for details.

814 questions
0
votes
1 answer

setData of vue-test-utils not re-updating the component

I'm using vue-test-utils with jest, I have router-link being rendered in a Login Component. I'm passing router to the component as well. There is data called 'email', on its update forgot link get's updated. Following unit-test checks…
Farhan Tahir
  • 2,096
  • 1
  • 14
  • 27
0
votes
1 answer

vue test utils TypeError: this.$moment(...).format is not a function

I am using moment.js and am having trouble mocking the format function am recieving this error: TypeError: this.$moment(...).format is not a function could any one point me in the right direction on this please? import { mount, createLocalVue, }…
0
votes
1 answer

How to find elementUi's componets during unit testing using vue-test-utils's with shallowMount?

After reading vue-test-utils's document, I am trying to hand on. Hope someone can clear my confusion. import { mount, shallowMount } from '@vue/test-utils' import Vue from 'vue' import Form from '@/components/Form/index.vue' import ElementUI from…
Billyyyyy3320
  • 176
  • 1
  • 1
  • 9
0
votes
1 answer

How to test more than 2 components using VeeValidate?

When I try to test 2 components (with 2 different test files), just the first file will pass. The second will fail with [Vue warn]: Error in directive validate bind hook: "TypeError: Cannot read property '$scopedSlots' of undefined". I'm really…
0
votes
1 answer

How to target first child of selector when testing component with jest

I'm trying to write a test to to target if a default prop is passed in the HTML correctly using jest and vue-test-utils. I can not seem to find my target selector. I want to be able to test that a particular p tag contains the proper text. In this…
Kevin T.
  • 668
  • 3
  • 12
  • 29
0
votes
2 answers

How to find component by their ID?

For Example, I have a Parent component with following template: I need to find a Child component with specific ID (say the one…
Stephen.W
  • 1,649
  • 13
  • 14
0
votes
1 answer

Vue-test-utils wrapper.find returns no item exists at 0

I have a component with two buttons like this: Delete
Phoenix
  • 321
  • 3
  • 12
0
votes
0 answers

Vue Testing Child Component Button Click from Parent Component

I'm trying to make a unit test for my vue page but I was stucked in a button trigger test. The parent cannot trigger the click function the button is a child component that accept props such as disabled, function and text The parent called the…
Andrew
  • 157
  • 1
  • 2
  • 11
0
votes
0 answers

How to test nested promise store actions

How to test nested promise method written in vue component written in method as you can see here that cancel method is nested promise so how to write test case using vue test utils & jest