From the course: Angular: Workflows
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Setting NPM scripts for testing - Angular Tutorial
From the course: Angular: Workflows
Setting NPM scripts for testing
- [Instructor] Setting up npm strips provides a great way to abstract long commands into a simple one. We have been using this command quite often, ng test --code-coverage. But we don't want to type this in every time we want to run our test suite. We can simply replace the current npm test script with this. Head over to your package.json, the scripts area. And we see the test npm script simply runs ng test. Let's go ahead and update this. Add the --code-coverage flag. I will also use the --progress flag, and set that to false to mute some of the verbose output. In our terminal, we can now run npm test. Sometimes it is very useful to run your tests in watch mode and have your test re-run whenever you change your code. Let's go ahead and add another script here. I will call it test:watch, ng test, use the --code-coverage flag, also the --progress flag set to false, and I will add a new one, which is the --watch. Let's run this script at the terminal, npm run test:watch. When we run…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.