angular 7 + angular cli 7+ ng test not working

1.9k views Asked by At

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.

2

There are 2 answers

0
bat7 On

Your path of the tsConfig is wrong. Change it to

"tsConfig": "apps/app/src/tsconfig.spec.json"
0
Dinesh Hiregange On

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