I've recently upgraded my projet from angular 7 to angular 9.
When I run the tests (ng test
), I always get http://localhost:9876/_karma_webpack_/
appendend to the error, hence in visual studio code, we can't click on the error to got directly to the file.
For the sake of testing, I've added expect(2).toEqual(1);
in the app.component.spec.ts
file
For example, with the angular 7 projet out of the box, I get this error with ng test:
Chrome 81.0.4044 (Windows 10.0.0) AppComponent should have as title 'angular7app' FAILED
Expected 2 to equal 1.
at UserContext.<anonymous> (src/app/app.component.spec.ts:23:12)
as for the angular 9, I get this error:
Chrome 81.0.4044.122 (Windows 10) AppComponent should have as title 'untaire' FAILED
Error: Expected 2 to be 1.
at <Jasmine>
at UserContext.<anonymous> (http://localhost:9877/_karma_webpack_/src/app/app.component.spec.ts:23:12)
When I check the versions in the package.json, theses are the changes that affects Karma and jasmine:
"@types/jasmine": "~2.8.8" to "~3.5.0"
"@types/jasminewd2": "~2.0.3" to "~2.0.3" (no changes)
"jasmine-core": "~2.99.1" to "~3.5.0"
"jasmine-spec-reporter": "~4.2.1", to "~4.2.1" (no changes)
"karma": "~4.0.0", to "~5.0.0"
"karma-chrome-launcher": "~2.2.0", to "~3.1.0"
"karma-coverage-istanbul-reporter": "~2.0.1", to "~2.1.0"
"karma-jasmine": "~1.1.2", to "~3.0.1"
"karma-jasmine-html-reporter": "^0.2.2", to "^1.4.2"
I've checked and I didn't found anything about this new behavior on any of theses packages