I'm right now upgrading my project from angular version 5.2 to angular version 7.2.
I ran the following commands:
Upgraded all angular packages package.json to ~7.2.0
ran
ng upgrade @angular/cli
ran
ng upgrade @angular/core
ran
ng test
and got the error:
Chrome 68.0.3440 (Windows 8.1.0.0) NdvAction ndv!!!! FAILED Error: Can't resolve all parameters for ApplicationModule: (?). at syntaxError node_modules/@angular/compiler/fesm5/compiler.js:2426:1) at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getDependenciesMetadata node_modules/@angular/compiler/fesm5/compiler.js:18979:1) at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getTypeMetadata node_modules/@angular/compiler/fesm5/compiler.js:18872:1) at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleMetadata node_modules/@angular/compiler/fesm5/compiler.js:18740:1) at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleSummary node_modules/@angular/compiler/fesm5/compiler.js:18550:1) at http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:18664:1 at Array.forEach (<anonymous>) at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleMetadata node_modules/@angular/compiler/fesm5/compiler.js:18652:1) at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleSummary node_modules/@angular/compiler/fesm5/compiler.js:18550:1) Chrome 68.0.3440 (Windows 8.1.0.0): Executed 1 of 395 (1 FAILED) (skipped 394) ERROR (0.527 secs / 0.038 secs)
I could minimal reproduce the issue on my project itself, couldn't reproduce it on an empty project, I created an empty service:
import { Injectable } from '@angular/core';
@Injectable()
export class NdvAction {
}
with an empty test case:
import { TestBed, inject } from '@angular/core/testing';
import { NdvAction } from './ndv.action';
fdescribe('NdvAction', () => {
let target: NdvAction;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [NdvAction]
});
});
beforeEach(inject([NdvAction],
(service: NdvAction) => {
target = service;
}));
it('ndv!!!!', () => {});
});
and I've got the error, when I removed the beforeEach with the inject([NdvAction] part, the error disappeared. Any idea what I'm doing wrong ? If you need any more details please let me know so that I'll add. My package.json looks like this:
"dependencies": {
"@angular-redux/store": "~9.0.0",
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/http": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"@ngx-translate/core": "~11.0.0",
"@ngx-translate/http-loader": "~4.0.0",
"angular2-moment": "^1.0.0",
"core-js": "2.4.1",
"cyb-core": "1.0.17-ng7",
"shell-utils": "~2.1.0",
"intl": "1.2.5",
"json-typescript-mapper": "1.1.3",
"lodash": "4.17.4",
"lodash-es": "4.16.0",
"lodash.get": "4.4.2",
"normalize.css": "4.2.0",
"normalizr": "3.2.3",
"primeng": "^5.2.4",
"redux": "~4.0.0",
"reflect-metadata": "0.1.10",
"rxjs": "~6.4.0",
"rxjs-compat": "~6.3.0",
"sass-flex-mixin": "1.0.3",
"string-template": "^1.0.0",
"tslib": "^1.9.0",
"web-animations-js": "2.3.1",
"zone.js": "0.8.27"
},
"devDependencies": {
"awesome-typescript-loader": "2.2.4",
"@types/lodash": "4.14.120",
"@angular-devkit/build-angular": "0.12.1",
"@angular/compiler-cli": "~7.2.0",
"@angular/cli": "~7.2.0",
"@types/jasmine": "2.5.46",
"@types/node": "7.0.18",
"codelyzer": "3.1.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.5.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.0.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"protractor": "5.1.0",
"ts-node": "3.0.2",
"tslint": "~5.12.0",
"typescript": "~3.2.0",
"test-reducer": "^2.0.2"
}
Thanks in advance.