Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 6 - How to stop generating spec files

In Angular 5 and earlier versions, to stop generating the spec files while generationg a component we had to add the following in .angular-cli.json file:

{
  ...
  "defaults": {
    "spec": {
      "class": false,
      "component": false,
      "directive": false,
      "module": false,
      "pipe": false,
      "service": false
    }
  }
}

in Angular 6+, following this link we have to add the next in the new angular.json file, under the schematics section:

  ....
  "schematics": {
    "@schematics/angular:component": {
      ....
      "properties": {
        ....
        "spec": {
          "type": "boolean",
          "description": "Specifies if a spec file is generated.",
          "default": false
        }
      }          
    }
  },

But when generating a new component a new spec file is still created, even after IDE restart, what is missing ?

like image 643
Sami-L Avatar asked May 26 '18 23:05

Sami-L


1 Answers

You can set it in the angular-cli.json as

{
  "defaults": {
    "component": {
      "spec": false
    }
  }
}

This will disable generating all spec files. If you want to disable on a specific component,

ng g c component-name --spec false
like image 100
Sajeetharan Avatar answered Sep 21 '22 00:09

Sajeetharan