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 ?
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.
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.
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.
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.
I solved it. Somehow when I upgraded the project to Angular 6 the tsConfig
key was missing under test -> options in angular.json
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With