I updated my project from Angular 6.4 to Angular 7.1 and now running the script: ng test app-name --coverage
gives me the error:
● Unrecognized CLI Parameters:
Following options were not recognized:
["main", "polyfills", "tsConfig"]
CLI Options Documentation:
https://jestjs.io/docs/en/cli.html
The configuration for the test command in angular.json looks like this:
"test": {
"builder": "@angular-builders/jest:run",
"options": {
"main": "apps/app-name/src/test.ts",
"polyfills": "apps/app-name/src/polyfills.ts",
"tsConfig": "apps/app-name/tsconfig.spec.json",
"configPath": "./jest.config.json",
"styles": [
"apps/app-name/src/styles.scss"
],
"scripts": [],
"assets": [
"apps/app-name/src/favicon.ico",
"apps/app-name/src/assets"
]
}
},
How am I supposed to update the config to be compatible with Angular 7?
The error was that I forgot to remove/replace the old karma-builder configuration when I moved to Jest.
Apparently Angular 7 checks things like that better than Angular 6 (hooray!), so I mistook it for an Angular or Jest bug.