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

查看:335
本文介绍了在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 
    },
    ...
}

推荐答案

版本"6.0.0" * .spec.ts可以使用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天全站免登陆