在组件生成时删除 nativescript angular 上的 .Spec 文件

Removing .Spec file on nativescript angular on component generation

我是 nativescript 机器人的新手,而不是 angular 的新手。我目前正在使用 angular 学习 nativescript。在 nativescript-NG 项目中生成组件时,我得到了引发语法错误的 .spec 文件。删除它可以解决问题。在所有情况下,我都想在没有 .spec 文件的情况下生成我的组件、服务、模块……。我曾经在 angular 中实现过这样的使用:

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

一定要用服务替换组件,模块...对于其他人。

这在 nativescript-Ng 中没有成功,这是非常正确的,因为 nativescript 使用 @nativescript/schematics 其中 angular 使用 @schematics/angular.

我试过了:

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

运气不好。

我怎样才能实现我的目标?

在您的 nativescript-NG 项目的 angular.json 文件中,添加以下内容:

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

已测试。希望对您有所帮助!

P.S:它适用于任何东西,只需将组件替换为您需要的即可:)