From the course: JavaScript: Test-Driven Development (ES6)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Run tests automatically

Run tests automatically - JavaScript Tutorial

From the course: JavaScript: Test-Driven Development (ES6)

Start my 1-month free trial

Run tests automatically

- [Instructor] So, now that we've seen quite a few examples of TDD and how tests fit into our whole workflow, you may have found yourself wondering if there's a way to run our tests automatically when we change our code. After all, it'd be very convenient to have instantaneous feedback whenever we make a change to our code since that would tell us, at every turn, whether what we're doing has broken something. Well, fortunately for us, it's actually incredibly easy to get our tests running automatically. All we have to do is open up our package.json file, and find our tests script. And at the end of this script, we're just going to add a flag that's --watch. And if we run our tests now, we see that all our tests will run, and then it will sit there, and wait for us to make changes to our code. So, if we open up our server.js file and introduce a breaking change, we'll immediately get that feedback that we broke something.…

Contents