Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 836
avni Avatar asked Feb 20 '26 04:02

avni


2 Answers

Your path of the tsConfig is wrong. Change it to

"tsConfig": "apps/app/src/tsconfig.spec.json"
like image 179
bat7 Avatar answered Feb 22 '26 13:02

bat7


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"
        ]
      }
    },
like image 39
Dinesh Hiregange Avatar answered Feb 22 '26 14:02

Dinesh Hiregange



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!