How to do it...

Let's suppose that we have an application that greets you with Hello World!, but it also has a button to translate the greeting to Italian, as Ciao Mondo!. For this, you need to create a new npm project in a new folder. There, you can install the dependencies required for this recipe with the following command:

npm install --save-dev vue karma jasmine karma-jasmine karma-chrome-   launcher

To set up Karma like in the previous recipe, run the following command:

./node_modules/karma/bin/karma init

Leave the default answers, except for the question What is the location of your source and test files ?; for that, you should answer with the following two lines:

  • node_modules/vue/dist/vue.js
  • *.js

Create a file called test.js ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.