There's more...

There is a widespread practice in software called TDD or Test-Driven Development. It encourages you to think about the features of your software as tests. This, in turn, enables you to ensure that the features in your software work because the tests themselves work.

In this bit, we will add a feature to our recipe using TDD. We want the page to have a header that says Welcome.

First, we will write a (failing) test for the feature inside the describe function after the hello world test:

it('should have an header that says `Welcome`', () => {  expect(document.querySelector('h1').innerText)    .toContain('Welcome')})

When we launch the test, we should see it fail:

Now, don't pay too much attention to the stack trace. The important ...

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.