logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.81k stars 1.26k forks source link

Custom input vee-validate test jest #3938

Closed ErikEndler closed 2 years ago

ErikEndler commented 2 years ago

vue 3 with vee-validate 4 trying to test with jest if I use stubs test work

const wrapper = mount(EmailView, {
  global: {
    plugins: [router],
    components: { NavBar, Form, TextInput },
    stubs: {
      TextInput: true,
    },
  },
});
await flushPromises();

but I can't test my custom inputs "text-input-stub"

<form novalidate="" id="formEmail" data-test="formEmail">
          <text-input-stub name="email" label="Correo electrónico" poppericon="icon-i.svg" mask="" cursor="" type="text" successmessage="" placeholder="Correo electrónico" reset="false" preventpaste="false" data-test="inputEmail"></text-input-stub>
          <text-input-stub name="emailConfirme" label="Confirma tu correo" poppericon="icon-i.svg" mask="" cursor="" type="text" successmessage="" placeholder="Confirma tu correo" reset="false" preventpaste="true" data-test="inputEmailConfirme"></text-input-stub>
        </form>

if i remove stub

const wrapper = mount(EmailView, {
  global: {
    plugins: [router],
    components: { NavBar, Form, TextInput },        
  },
});
await flushPromises();

test error

node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:2752 if (dir.deep) {

TypeError: Cannot read properties of undefined (reading 'deep')

logaretm commented 2 years ago

Can you create a simple minimal repo with the failing test? not sure I follow.