简体   繁体   中英

angular 7 + angular cli 7+ ng test not working

angular 7 + angular cli 7.1.0

upgraded project from angular 5 to 7 and when run ng test

and tsConfig added in angular.json file

` "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'.

What am I doing wrong? Thanks in advance.

Your path of the tsConfig is wrong. Change it to

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

In my angular 7 project ng test is working. below is my agular.json file test configuration.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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