角度cli 6,ng测试不起作用

use*_*184 23 angular-cli angular angular6

我刚刚将角度项目更新为角度6.

ng build和ng服务工作,但是当我使用命令运行我的测试时:

ng test
Run Code Online (Sandbox Code Playgroud)

我得到输出:

Schema validation failed with the following errors:
Data path "" should have required property 'tsConfig'.
Run Code Online (Sandbox Code Playgroud)

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"
]
}
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么 ?

use*_*184 28

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


Cha*_*yen 15

为了我:

file:angular.json

json节点路径:projects - > {{yourProjectName}} - > architect-> test-> options

补充:"tsConfig":"src/tsconfig.json"