File 'src/app/app.component.spec.ts' is not part of Typescript project while upgrading to Angular 5

倖福魔咒の 提交于 2020-05-29 05:32:27

问题


File 'src/app/app.component.spec.ts' is not part of Typescript project 'src/tsconfig.app.json' while upgrading to Angular 5

We have followed all the instructions for converting our project from angular 4 but are pulling out our hair over this one - anyone have any ideas?

We are getting this error from tslint...


回答1:


Change the "lint" section of .angular-cli.json by replacing all of the "files" entries with "exclude" entries...

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

becomes

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



回答2:


Turns out the files specified in our .angular-cli.json for our lint configuration, but we should have been just relying on the files specified in our tsconfig.json files. We removed the files from angular-cli.json and all is well.



来源:https://stackoverflow.com/questions/47778839/file-src-app-app-component-spec-ts-is-not-part-of-typescript-project-while-upg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!