CHAPTER 11
Angular is a complete application development framework for creating component-based web applications. The testing environment used by Angular allows a developer or a team of developers to create a more robust application, with the goal of reducing bugs and providing a solid development and testing environment.
By using the various frameworks and tools, you can create a rich testing environment for yourself or a complete team. Take the time to set up and take advantage of these tools to reduce those late night, “uh oh, something broke” phone calls.
The following websites provide more information about the testing tools available to the Angular framework.
The default linter installed by Angular CLI is TSLint, and it can be found at palantir.github.io/tslint. Keep in mind that while this is a powerful lint tool, it is deprecated in favor of ESLint.
ESLintESLint is the lint tool that the developers of TypeScript have decided to use going forward. The author of TSLint has indicated support for the development effort of ESLint, and plans to deprecate TSLint. You can find out more about ESLint at eslint.org.
ESLint also supports plugins to allow further rule definitions. One such plugin is the ESLint plugin for Angular, available at github.com/EmmanuelDemey/eslint-plugin-angular.
If you install this plugin to your development environment, you will need to update your ESLint configuration file (.eslintrc) to include the following setting:
“plugins”: [ “angular”, “@typescript-eslint”]
SonarQube is a leading code-quality tool. It has over 100,000 users and can be used with 27 different languages. SonarLint is a lint checker you can integrate into your IDE, and can be found at sonarlint.org.
While some of the issues raised by SonarLint will be caught by other linting tools, SonarLint provides integration in the editor to allow you to find and fix the issues while you are developing your code.
Karma is a command line tool used to spawn a web server that can run your application test files. You can find information on the Karma application at karma-runner.github.io/0.12/index.html.

Jasmine is the open-source library that provides a structured set of methods to perform unit testing and E2E testing with the Angular framework. Documentation for the Jasmine framework can be found at jasmine.github.io/index.html.
You can see Appendixes A and B for some details on the Jasmine testing framework.
ProtractorProtractor is the end-to-end test framework used by Angular to run your E2E test suite. It allows your tests to be run in an actual browser, behaving as an end user would. You can find out more about Protractor at protractortest.org.
Protractor runs tests written in the Jasmine framework with Angular E2E testing.
Cucumber is a framework for behavior-driven development that allows you to test suites written in the Gherkin syntax. The Given/When/Then syntax of Gherkin is a popular language for business analysts to write feature files. You can learn about the framework at cucumber.io.
Although Cucumber and Gherkin are not the default test frameworks for Angular, they are popular solutions for behavior-driven development processes. Appendix C provides a list of the Gherkin keywords.
There is a large collection of testing tools and applications for the Angular development environment. We summarized some of the tools covered in the book in this chapter. Take the time to create your own development testing setup. It will greatly improve the quality of your Angular application and code.