简体   繁体   English

我在angular-cli.json中包含exclude后,规范文件被删除

[英]Spec files are being linted after I included exclude in angular-cli.json

I have an angular 4 app and manually created 2 .spec files for a class. 我有一个angular 4应用程序,并为一个类手动创建了2个.spec文件。 When I run nglint , it will lint the 2 spec files. 当我运行nglint ,它将nglint 2个spec文件。 The spec files that were included when I generated a component with the angular-cli are not being linted however (which is what I want) 但是,当我生成带有angular-cli的组件时所包含的规范文件并没有被删除(这是我想要的)

I have added the following property to my .angular-cli.json file, but it still lints the files: 我已将以下属性添加到我的.angular-cli.json文件中,但它仍然不掉毛文件:

"lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/**/*.spec.ts"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/**/*.spec.ts"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/**/*.spec.ts"
    }
],

My spec files are located within /src/app/folder/ 我的规格文件位于/ src / app / folder /

Tried now, once you add "**/**/*.spec.ts" to angular-cli.json - lint - exclude , it will stop linting any .spec file down from the app folder, no mater how deep you nest the folders. 现在尝试过,将"**/**/*.spec.ts"angular-cli.json - lint - exclude ,它将停止从app文件夹中向下.spec任何.spec文件,而不管嵌套的深度如何文件夹。

This is the angular-cli.json code I tested with: 这是我测试过的angular-cli.json代码:

"lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": ["**/node_modules/**", "**/**/*.spec.ts"]
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],

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

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