I have upgraded Angular app recently along with Material, but somehow it resulted in more and more test fails.
So, I would like to understand, whether it is a mandatory step to update the versions of jasmine & karma related package dependencies in package.json ? Because as per the version compatibility, we do update the versions of tslib, rxjs, typescript & nodejs etc in the package.json. So does it apply same to Jasmine & Karma?
If yes, how to do that? Will it solve the test case fails issue occurred after angular v15 upgrade? All these tests were passing earlier.
Please provide a solution.
There has been some testing logic upgrades in 15
, You can find the comprehensive steps on V15 below
Angular Upgrade Guide V14 -> V15
Have you done the below steps?
- Update instances of Injector.get() that use an InjectFlags parameter to use an InjectOptions parameter. The InjectFlags parameter of Injector.get() is deprecated in v15. Read further
- Update instances of TestBed.inject() that use an InjectFlags parameter to use an InjectOptions parameter. The InjectFlags parameter of TestBed.inject() is deprecated in v15. Read further
Also check if the correct versions are set for karma
and jasmine
below is a stackblitz of a new project using angular 15, the versions should match, if you have a different version of angular 15, then first do npm i -g @angular/cli@<<version>>
then do ng new test
, then check the versions of karma
and jasmine
and verify all versions are the same!
"@angular-devkit/build-angular": "^15.2.10",
"@angular/cli": "~15.2.10",
"@angular/compiler-cli": "^15.2.0",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.9.4"