在 Angular 6 中生成没有 *.spec.ts 的组件 [英] Generating Components without *.spec.ts in Angular 6

查看:34
本文介绍了在 Angular 6 中生成没有 *.spec.ts 的组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以前的版本中,可以使用 .angular-cli.json 禁用 spec.ts,如下所示.6.0.0 版本的 angular.json 有什么办法吗?

In previous version, spec.ts can be disabled with .angular-cli.json as below. Is there any way to do it with angular.json in version 6.0.0?

"defaults": {
    "component": { 
        "spec": false 
    },
    "service": { 
        "spec": false 
    },
    ...
}

推荐答案

in version "6.0.0" *.spec.ts can be disabled with angular.json

in version "6.0.0" *.spec.ts can be disabled with angular.json

注意:不要忘记将前缀"属性值fmyp"和fmp"更改为您的.

NOTE: don't forget to change the "prefix" property values "fmyp" and "fmp" to yours.

"schematics": {
    "@schematics/angular:component": {
      "prefix": "fmyp",
      "styleext": "css",
      "spec": false
    },
    "@schematics/angular:directive": {
      "prefix": "fmp",
      "spec": false
    },
    "@schematics/angular:module": {
      "spec": false
    },
    "@schematics/angular:service": {
      "spec": false
    },
    "@schematics/angular:pipe": {
      "spec": false
    },
    "@schematics/angular:class": {
      "spec": false
    }
  }

这篇关于在 Angular 6 中生成没有 *.spec.ts 的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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