升级到 Angular 5 时,文件“src/app/app.component.spec.ts"不是 Typescript 项目的一部分 [英] File 'src/app/app.component.spec.ts' is not part of Typescript project while upgrading to Angular 5

查看:20
本文介绍了升级到 Angular 5 时,文件“src/app/app.component.spec.ts"不是 Typescript 项目的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到 Angular 5 时,文件src/app/app.component.spec.ts"不是 Typescript 项目src/tsconfig.app.json"的一部分

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

我们已按照将项目从 angular 4 转换的所有说明进行了操作,但正在为这个问题梳理头发 - 有人有任何想法吗?

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?

我们从 tslint 得到这个错误...

We are getting this error from tslint...

推荐答案

通过将所有文件"条目替换为排除"条目来更改 .angular-cli.json 的lint"部分...

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"
}]

变成

"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/**"
}]

这篇关于升级到 Angular 5 时,文件“src/app/app.component.spec.ts"不是 Typescript 项目的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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