Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all the spec files from existing Angular cli project

Tags:

angular

I am currently working with angular cli project. I see the spec file generated for every component, services and I want to remove all this spec files from this existing project.

like image 633
karansys Avatar asked Mar 28 '19 13:03

karansys


People also ask

Can I delete Spec TS files?

As said around: if you don't plan on testing you can delete spec. ts files manually.

How do I create a spec TS file in angular existing component?

Angular spec (jest / jasmine / mockito) file generatorSelect an Angular *. ts file and use right click to generate the spec file. Generate spec (jest / jasmine / mockito / empty) files for Angular elements: component.

What is .angular folder?

Files used in Angular 7 App folder src folder: This is the folder which contains the main code files related to your angular application. app folder: The app folder contains the files, you have created for app components. app. component.


1 Answers

Deleting them from an existing project depends on your OS. If it is a Unix based system you could do something like this:

find . -type f -name '*.spec.ts' -delete

This would remove all files which end in spec.ts recursively starting in your current directory.

To prevent these files from being generated again use the --skipTests flag when generating components, providers, whatever:

ng g s my-service --skipTests

This will generate a service my-service without any spec files.

like image 137
Mathyn Avatar answered Oct 23 '22 08:10

Mathyn