简体   繁体   English

角度7 +角度cli 7+ ng测试不起作用

[英]angular 7 + angular cli 7+ ng test not working

angular 7 + angular cli 7.1.0 角7 +角度cli 7.1.0

upgraded project from angular 5 to 7 and when run ng test 升级项目从角度5到7以及运行ng test

and tsConfig added in angular.json file 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",`

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

What am I doing wrong? 我究竟做错了什么? Thanks in advance. 提前致谢。

Your path of the tsConfig is wrong. 你的tsConfig的路径是错误的。 Change it to 将其更改为

"tsConfig": "apps/app/src/tsconfig.spec.json"

In my angular 7 project ng test is working. 在我的角度7项目中,ng测试工作正常。 below is my agular.json file test configuration. 下面是我的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"
        ]
      }
    },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM