Google+

Wednesday, May 13, 2020

How to change Angular.json settings to generate components without test files

In this article we review How to change Angular.json settings to generate components without test files  using Angular 7,  by changing the settings at the angular.json file of an Angular Application.

Tired of typing " --spec false " every time you create an Angular component using the CLI ? :



How to change Angular.json settings to generate components without test files  using Angular7

In addition, you might even found that  " --spec false "  is deprecated:


So why not changing the settings at the angular.json file ?



Therefore, open the angular.json file and search for the "schematics" section, and add the following lines:

    "schematics": {
        
        "@schematics/angular:component": {
          "skipTests": true
        }


Or:


Next time you use the CLI for creating a component, you will automatically have no testing files:



Also, you can do the same for other kinds of angular,s building blocks, such as guards, directives, pipes, etc :

"@schematics/angular:class": {
          "skipTests": true
        },
        "@schematics/angular:component": {
          "skipTests": true
        },
        "@schematics/angular:directive": {
          "skipTests": true
        },


That's All!!! 
Enjoy Angular.....

      by Carmel Schvartzman

כתב: כרמל שוורצמן