[SOLVED] [+Vue] Unit Testing


#1

Does someone have a guide on a way to unit test framework7 + vue? There are nice guides for unit testing VUE itself, but because Framework7 shows up in my templates as modules, the tests always barf.

Then, no matter how I try to “import Framework7” (just like in my main.js file), the tests barf because they can’t process the IMPORT statements WITHIN the Framework7 module.

Does ANYONE have unit testing working for Framework7 + Vue? If so, is there any chance you wrote a post or article about it somewhere?

Guides for Vue Unit Testing:
https://vue-test-utils.vuejs.org/guides/choosing-a-test-runner.html
https://vue-test-utils.vuejs.org/guides/testing-single-file-components-with-jest.html
https://vue-test-utils.vuejs.org/

I love working with Vue and really like Framework7. But this lack of Unit Testing for a nice Vue+Framework7 app is a real showstopper. :frowning:

Any ideas?


#2

I’ve found the easiest way is when I do a ‘mount(ModuleName’, to include something like stubs: ['f7Page','f7View','f7List','f7ListItem','f7Icon'] in it’s options.

Thus the errors are gone, and I don’t have to actually import or initialize Framework7. :slight_smile:

I realize this method has it’s downsides, as in that I won’t be able to see a generated input (from f7Input), but I think I can work around that.

I’t would be nice though if someone wrote up an article or example of how to properly unit test a Framework7 + Vue module with something simple like one input field.