Testing Vue Components

unit testing Vue components

If you have gone through the official Vue docs then you have come across the section on unit testing. It goes over the basics of unit testing Vue components, and it’s definitely worth checking before reading this tutorial.

To test .vue components, you need to compile the files before running your tests. You can do this is with webpack and vue-loader.

If you’re using Karma to run your tests, you can use the preProcessors option in the Karma configuration file. Have a look at this project to see a working example.

  • Testing Vue components using avoriaz

avoriaz is similar to enzyme a react testing utils library. If you’re having trouble setting up, clone the avoriaz mocha example project, and then you can begin your tests.

Testing Vue Components on coding123.org.

Created by Edd Yerburgh, Submitted by Eremenko Stanislav