Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Should we upgrade Jasmine and Karma related dependencies too during Angular upgrade from 14 to 15?

I have upgraded Angular app from v14 to v15 recently along with Materialv15 and MDC, 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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Please provide a solution.

>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"

Stackblitz Demo

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading