Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular cli 6, ng test not working

I have just updated my angular project to angular 6.

ng build and ng serve work, but when I run my tests with the command:

ng test 

I get the output:

Schema validation failed with the following errors: Data path "" should have required property 'tsConfig'. 

tsconfig.json:

{ "compilerOptions": { "baseUrl": "", "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": [   "es2016",   "dom" ], "mapRoot": "./", "module": "es2015", "moduleResolution": "node", "outDir": "../dist/out-tsc", "sourceMap": true, "target": "es5", "typeRoots": [   "../node_modules/@types" ] } } 

What am I doing wrong ?

like image 436
user3594184 Avatar asked May 10 '18 12:05

user3594184


People also ask

What is ng Test Command in angular?

This chapter explains the syntax, argument and options of ng test command along with an example. ng test run the unit test cases on angular app code. The name of the project to test. Options are optional parameters. Override which browsers tests are run against. Output a code coverage report. Globs to exclude from code coverage.

Why is the angular CLI build system not working?

the Angular CLI build system was splitting the common parts of polyfills and test but not loading the common bits. This resulted in no error messages and no tests ran.

Do jest tests work with angular 6?

Before upgrading to Angular 6 all tests were working fine. Jest is also not an option for our project since almost all tests need to be updated. I can confirm that the spec files are bundled by webpack and served to karma.

What is the last line of output before ng test finishes?

The Executed 0 of 0 ERROR (0.009 secs / 0 secs) is the last line of the output for me before ng test finishes. Sorry, something went wrong. I've done some more investigation.


1 Answers

I solved it. Somehow when I upgraded the project to Angular 6 the tsConfig key was missing under test -> options in angular.json.

like image 77
user3594184 Avatar answered Oct 08 '22 00:10

user3594184