3

角度 7 + 角度 cli 7.1.0

将项目从 Angular 5 升级到 7 并在运行时 ng test

tsConfig添加到angular.json文件中

` "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "test.js",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "apps/app/src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",`

我得到输出 Schema validation failed with the following errors: Data path "" should have required property 'tsConfig'.

我究竟做错了什么?提前致谢。

4

2 回答 2

2

您的 tsConfig 路径错误。将其更改为

"tsConfig": "apps/app/src/tsconfig.spec.json"
于 2018-12-04T08:58:02.510 回答
1

在我的 Angular 7 项目中,ng 测试正在运行。下面是我的 agular.json 文件测试配置。

   "test": {
      "builder": "@angular-devkit/build-angular:karma",
      "options": {
        "main": "src/test.ts",
        "karmaConfig": "./karma.conf.js",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "src/tsconfig.spec.json",
        "scripts": [
          "src/assets/jquery-3.2.1.min.js",
          "src/assets/vendor/bootstrap/js/bootstrap.min.js",
        ],
        "styles": [
          "src/assets/vendor/bootstrap/css/bootstrap.css",
        ],
        "assets": [
          "src/assets",
          "src/favicon.ico"
        ]
      }
    },
于 2019-05-27T06:49:42.963 回答