I recently updated my Angular project and its dependencies to the newest version. But I have some errors when I try to run my test:
Error: node_modules/jasmine-spec-reporter/built/spec-reporter.d.ts:25:5 - error TS2416: Property 'suiteStarted' in type 'SpecReporter' is not assignable to the same property in base type 'CustomReporter'.
Type '(result: import("C:/Users/davide.cividini/Projects/g3pharmacy/frontend/node_modules/jasmine-spec-reporter/built/spec-reporter").CustomReporterResult) => void' is not assignable to type '(result: jasmine.CustomReporterResult) => void'.
Types of parameters 'result' and 'result' are incompatible.
Type 'jasmine.CustomReporterResult' is not assignable to type 'import("C:/Users/davide.cividini/Projects/g3pharmacy/frontend/node_modules/jasmine-spec-reporter/built/spec-reporter").CustomReporterResult'.
Types of property 'duration' are incompatible.
Type 'number' is not assignable to type 'string'.
25 suiteStarted(result: CustomReporterResult): void;
~~~~~~~~~~~~
Error: node_modules/jasmine-spec-reporter/built/spec-reporter.d.ts:26:5 - error TS2416: Property 'suiteDone' in type 'SpecReporter' is not assignable to the same property in base type 'CustomReporter'.
Type '(result: import("C:/Users/davide.cividini/Projects/g3pharmacy/frontend/node_modules/jasmine-spec-reporter/built/spec-reporter").CustomReporterResult) => void' is not assignable to type '(result: jasmine.CustomReporterResult) => void'.
Types of parameters 'result' and 'result' are incompatible.
Type 'jasmine.CustomReporterResult' is not assignable to type 'import("C:/Users/davide.cividini/Projects/g3pharmacy/frontend/node_modules/jasmine-spec-reporter/built/spec-reporter").CustomReporterResult'.
26 suiteDone(result: CustomReporterResult): void;
~~~~~~~~~
Error: node_modules/jasmine-spec-reporter/built/spec-reporter.d.ts:27:5 - error TS2416: Property 'specStarted' in type 'SpecReporter' is not assignable to the same property in base type 'CustomReporter'.
Type '(result: import("C:/Users/davide.cividini/Projects/g3pharmacy/frontend/node_modules/jasmine-spec-reporter/built/spec-reporter").CustomReporterResult) => void' is not assignable to type '(result: jasmine.CustomReporterResult) => void'.
Types of parameters 'result' and 'result' are incompatible.
Type 'jasmine.CustomReporterResult' is not assignable to type 'import("C:/Users/davide.cividini/Projects/g3pharmacy/frontend/node_modules/jasmine-spec-reporter/built/spec-reporter").CustomReporterResult'.
27 specStarted(result: CustomReporterResult): void;
This is the command that I run:
ng test --browsers=Chrome --code-coverage --karmaConfig=src/karma-dev.conf.js
Those are my dependencies:
"jasmine-core": "~3.6.0",
"jasmine-marbles": "^0.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "^6.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "^2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-junit-reporter": "^2.0.1",
"karma-parallel": "^0.3.1",
And this is my karma-dev.conf.js:
module.exports = function (config) {
config.set({
files: [ '../node_modules/mark.js/dist/mark.min.js' ],
basePath: '',
frameworks: [ 'jasmine', '@angular-devkit/build-angular' ],
plugins: [
require('karma-coverage'),
require('karma-chrome-launcher'),
require('karma-jasmine'),
require('karma-jasmine-html-reporter'),
require('karma-junit-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
jasmine: {
random: false
}
},
coverageReporter: {
type : 'html',
dir : '../../../coverage/'
},
reporters: [ 'progress', 'kjhtml', 'junit' ],
junitReporter: {
outputDir: '',
outputFile: undefined,
suite: '',
useBrowserName: true,
nameFormatter: undefined,
classNameFormatter: undefined,
properties: {},
xmlVersion: null
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: [ 'Chrome', 'ChromeHeadless', 'ChromeHeadlessCI', 'ChromeDebugging', 'HeadlessChrome' ],
captureTimeout: 120000,
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 210000,
browserNoActivityTimeout : 210000,
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: [ '--no-sandbox' ]
},
ChromeDebugging: {
base: 'Chrome',
flags: [ '--remote-debugging-port=9333' ]
},
HeadlessChrome:{
base: 'ChromeHeadless',
flags: [ '--no-sandbox' ]
}
},
singleRun: false
});
};
Before with Angular 10 everythings worked well. I also tried to replace the older Karma version but not works. Someone can help me? Thanks everybody.