简体   繁体   English

如何从现有的Angular CLI项目中删除所有规范文件

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

I am currently working with angular cli project. 我目前正在与angular cli项目合作。 I see the spec file generated for every component, services and I want to remove all this spec files from this existing project. 我看到为每个组件,服务生成的规范文件,并且我想从现有项目中删除所有这些规范文件。

Deleting them from an existing project depends on your OS. 从现有项目中删除它们取决于您的OS。 If it is a Unix based system you could do something like this: 如果它是基于Unix的系统,则可以执行以下操作:

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

This would remove all files which end in spec.ts recursively starting in your current directory. 这将从当前目录中递归删除所有以spec.ts结尾的文件。

To prevent these files from being generated again use the --skipTests flag when generating components, providers, whatever: 为了防止再次生成这些文件,请在生成组件,提供程序时使用--skipTests标志,无论如何:

ng g s my-service --skipTests

This will generate a service my-service without any spec files. 这将生成没有任何规格文件的服务my-service

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM