Angular CLI 为已经存在的组件创建 .spec 文件 [英] Angular CLI create .spec files for already existing components

查看:33
本文介绍了Angular CLI 为已经存在的组件创建 .spec 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.angular-cli.json 中有一个选项可以禁用自动创建 *.spec 文件,例如对于组件,请参阅 json 架构.

There is an option in .angular-cli.json to disable the automatic creating of *.spec files e.g. for components, see json schema.

这是一个非常好的功能,因为个人(这只是我的意见)在快速增长的项目中测试组件可能不是真正值得的事情.

This is a really nice feature because personally (this is just my opinion) testing the components might not be the thing that really worth it in a fast growing project.

但是有时我希望有一个选项来为已经存在的组件/服务/管道/任何东西生成/重新创建相应的*.spec文件.

However sometimes I would like to have an option to generate / recreate the corresponding *.spec file for an already existing component / service / pipe / whatsoever.

可以使用一些命令行调用吗?

Is that possible using some command line call?

创建了一个功能请求,让我们看看进展如何...

Created a feature request, let's see how it goes...

推荐答案

目前 Angular CLI 不提供此功能,并且不清楚如何以及何时可以以官方方式管理它.

Currently Angular CLI does not provide this functionality and it is not clear how and when it will be possible to manage it in official way.

然而,这里有一个库ngx-spec",它根据 Angular CLI 规范预设生成规范.

这篇关于Angular CLI 为已经存在的组件创建 .spec 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆