Search code examples
angularnativescriptangular2-nativescriptnativescript-angular

Removing .Spec file on nativescript angular on component generation


I am new to nativescript bot not new to angular. I am learning nativescript with angular at the moment. When generating a component in nativescript-NG project, I am getting the .spec file which is throwing syntax errors. Deleting it solves the problem. In all cases, I want to generate my components, services, modiules... without the .spec file. I used to achieve so in angular using:

ng config schematics.@schematics/angular.component.spec false

Surely replace component by service, module... for others.

This did not succeed in nativescript-Ng which is very true as nativescript uses @nativescript/schematics where angular uses @schematics/angular.

I tried:

ng config schematics.@nativescript/schematics.component.spec false

with no luck.

How can I achive my goal?


Solution

  • In your angular.json file in your nativescript-NG project, add the following:

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

    Tested now. Hope it helps!

    P.S: It works on anything, just replace component with what you need :)