How to do it...

For this recipe to work, you will need two dependencies: Mocha and Chai. You will find them in no time with Google; just remember that Mocha comes in two different files: mocha.js and mocha.css. You will have to add them both if you want it to display nicely.

If you are using JSFiddle, continue as usual; otherwise, just make sure to have Vue as well in the dependencies.

Our HTML layout will look like this:

<div id="app">  <p>{{greeting}}</p></div><div id="mocha"></div>

The mocha bit is where all the results will be presented.

In the JavaScript part, write the simplest Vue application and assign it to a variable:

const vm = new Vue({  el: '#app',  data: {    greeting: 'Hello World!'  }})

We will write a test to see whether the ...

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.