I have this error, following a few minor update.
I just have update a few angular stuff, but I don't know what I have to fix in my karma.config to fix it.
The fun part is, I don't have any config of webpack anywhere.
An error was thrown in afterAll
Uncaught TypeError: Cannot read properties of undefined (reading 'XXXXXService')
TypeError: Cannot read properties of undefined (reading 'XXXXXXService')
at Module.XXXXXService (http://localhost:9878/_karma_webpack_/main.js:12230:113)
at Module.15940 (http://localhost:9878/_karma_webpack_/webpack:/src/app/@shared/services/YYYYYYYYY.service.ts:30:28)
at __webpack_require__ (http://localhost:9878/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at Module.22076 (http://localhost:9878/_karma_webpack_/main.js:12251:79)
at __webpack_require__ (http://localhost:9878/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at Module.19420 (http://localhost:9878/_karma_webpack_/main.js:8888:74)
at __webpack_require__ (http://localhost:9878/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at Module.9509 (http://localhost:9878/_karma_webpack_/main.js:10190:110)
at __webpack_require__ (http://localhost:9878/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at Module.27601 (http://localhost:9878/_karma_webpack_/main.js:7256:72)
My karma.conf.js:
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/new'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
package.json:
"dependencies": {
"@angular/animations": "13.3.11",
"@angular/cdk": "13.3.9",
"@angular/common": "13.3.11",
"@angular/compiler": "13.3.11",
"@angular/core": "13.3.11",
"@angular/forms": "13.3.11",
"@angular/localize": "13.3.11",
"@angular/material": "13.3.9",
"@angular/material-moment-adapter": "13.3.9",
"@angular/platform-browser": "13.3.11",
"@angular/platform-browser-dynamic": "13.3.11",
"@angular/router": "13.3.11",
"@angular/service-worker": "13.3.11",
"@ngx-rocket/scripts": "4.0.0",
"@ngx-translate/core": "13.0.0",
"@types/uuid": "8.3.0",
"angular-google-tag-manager": "1.5.1",
"angular-spec-creator": "^1.7.0",
"angular-unit-test-generator": "^1.0.3",
"moment": "2.29.3",
"moment-timezone": "0.5.34",
"ngx-google-analytics": "11.2.1",
"rxjs": "7.5.5",
"tslib": "2.3.1",
"uuid": "8.3.2",
"zone.js": "0.11.6"
},
"devDependencies": {
"@angular-builders/jest": "13.0.4",
"@angular-devkit/build-angular": "13.3.8",
"@angular/cli": "13.3.8",
"@angular/compiler-cli": "13.3.11",
"@angular/language-service": "13.3.11",
"@angularclass/hmr": "3.0.0",
"@biesbjerg/ngx-translate-extract": "7.0.3",
"@biesbjerg/ngx-translate-extract-marker": "1.0.0",
"@types/jasmine": "3.10.6",
"@types/jasminewd2": "2.0.8",
"@types/jest": "26.0.12",
"@types/node": "12.20.55",
"codelyzer": "6.0.2",
"hads": "2.1.0",
"htmlhint": "0.16.3",
"https-proxy-agent": "5.0.1",
"husky": "4.2.5",
"jasmine-core": "3.99.1",
"jasmine-spec-reporter": "5.0.2",
"jest": "27.5.1",
"ngx-spec": "^2.1.5",
"openapi-typescript-codegen": "^0.23.0",
"prettier": "2.1.1",
"pretty-quick": "3.0.0",
"protractor": "7.0.0",
"stylelint": "13.7.2",
"stylelint-config-prettier": "8.0.2",
"stylelint-config-recommended-scss": "4.2.0",
"stylelint-config-standard": "20.0.0",
"stylelint-scss": "3.18.0",
"ts-node": "10.7.0",
"tslint": "6.1.3",
"tslint-config-prettier": "1.18.0",
"typescript": "4.6.4",
"@types/jasmine": "~3.10.0",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0"
},