Last active
June 13, 2019 17:42
Revisions
-
AlbinoDrought revised this gist
Jun 13, 2019 . No changes.There are no files selected for viewing
-
AlbinoDrought revised this gist
Jun 13, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ describe('Form.vue', () => { it('should look fantastic', () => { const wrapper = mount(Form, { // <-- big red squiggly here preventing you from moving further props: { title: 'I am a talking computer', }, }); }); @@ -42,7 +42,7 @@ describe('Form.vue', () => { it('should look fantastic', () => { const wrapper = mount(Form, { propsData: { // <-- `propsData` instead of `props` title: 'I am a talking computer', }, }); }); -
AlbinoDrought created this gist
Jun 13, 2019 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ # @vue/test-utils cryptic error Encountered this and I know I'll end up making the same mistake again. Saving it here so I can hopefully find it on Bing :tm: in the future. ## Error ```english Argument of type 'VueConstructor<Vue>' is not assignable to parameter of type 'FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>>'. Property 'functional' is missing in type 'VueConstructor<Vue>' but required in type 'FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>>'. ``` ## Sample Test ```ts import { Wrapper, config, mount } from '@vue/test-utils'; import Form from '@/components/Form.vue'; describe('Form.vue', () => { it('should look fantastic', () => { const wrapper = mount(Form, { // <-- big red squiggly here preventing you from moving further props: { title: 'I am a talking computer',', }, }); }); }); ``` ## The Fix When using `@vue/test-utils`, props are passed to components using `propsData`, **not** `props`. Using `props` causes the above cryptic error message. ```ts import { Wrapper, config, mount } from '@vue/test-utils'; import Form from '@/components/Form.vue'; describe('Form.vue', () => { it('should look fantastic', () => { const wrapper = mount(Form, { propsData: { // <-- `propsData` instead of `props` title: 'I am a talking computer',', }, }); }); }); ```