首页 > 解决方案 > 角度cli 6,ng测试不起作用

问题描述

我刚刚将我的 Angular 项目更新为 Angular 6。

ng build 和 ng serve 工作,但是当我使用以下命令运行测试时:

ng test

我得到输出:

Schema validation failed with the following errors:
Data path "" should have required property 'tsConfig'.

tsconfig.json:

{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
  "es2016",
  "dom"
],
"mapRoot": "./",
"module": "es2015",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
  "../node_modules/@types"
]
}
}

我究竟做错了什么 ?

标签: angularangular-cliangular6

解决方案


我解决了。不知何故,当我将项目升级到 Angular 6 时,tsConfig密钥在 test -> options 中丢失了angular.json


推荐阅读