Open taxenco opened 2 years ago
We are having this issue over here as well. Have you found any fix / workaround so far?
Just tinkered it out, this works for us:
Make sure your jest.config.js
contains:
module.exports = {
// ...
transformIgnorePatterns: [
"node_modules/(?!(@koumoul|vuetify)/)"
]
// ...
}
I am currently performing a unit test for a large form I have created using v-jsf.
The form displays correctly and it seems to work ok. However, it does not allow me to do unit tests.
I am using jest for testing and it works ok for the rest of components of my VUE application, but the koumoul-dev/vjsf.
Form.vue
<v-jsf v-model="model" :schema="schema" :options="options" @input="logEvent('input', $event)" autocomplete="off"/>
**Form.spec.js (First attempt importing VJsf library )**
import Form from "/form"; import { createLocalVue, mount } from "@vue/test-utils"; import data from ".data.json"; import schema from "./schema.json"; import VJsf from '@koumoul/vjsf/lib/VJsf.js'; import Vuetify from "vuetify";
describe('form', () => { const localVue = createLocalVue(); let vuetify; let vjsf;
}) })
Output (First attempt):
Form.spec.js (Second attempt not importing VJsf library)
import Form from "/form"; import { createLocalVue, mount } from "@vue/test-utils"; import data from ".data.json"; import schema from "./schema.json"; import Vuetify from "vuetify";
describe('form', () => { const localVue = createLocalVue(); let vuetify;
}) })
Output of console.log(wrapper.html()):
Output of console.log(wrapper.find('#email')): Note: Email input field is displaying correctly and has and id='email'. The same logic has been applied successfully on other Vue input fields.
ErrorWrapper { selector: '#email' }
I would appreciate any help on how to solve this issue.
Thank you in advance for your time.