ABP Framework version: v8.0.4
UI Type: Angular
Database System: EF Core
Exception message and full stack trace:
Error: Unexpected value 'undefined' imported by the module 'DynamicTestModule'. Please add an @NgModule annotation. at verifySemanticsOfNgModuleDef (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:28929:19) at forEach (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:28940:9) at Array.forEach (<anonymous>) at verifySemanticsOfNgModuleDef (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:28938:60) at Function.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:28891:30) at TestBedCompiler.applyProviderOverridesInScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/testing.mjs:1110:33) at TestBedCompiler.compileTestModule (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/testing.mjs:1405:14) at TestBedCompiler.finalize (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/testing.mjs:935:14) at TestBedImpl.testModuleRef (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/testing.mjs:1932:49) at TestBedImpl.inject (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/testing.mjs:1842:29)
TypeError: Cannot read properties of undefined (reading 'componentInstance') at UserContext.apply (http://localhost:9876/_karma_webpack_/webpack:/src/app/rule/rule-definition-management/rule-definition-management.component.spec.ts:94:13) at _ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:368:26) at ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:273:39) at _ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:367:52) at Zone.run (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:129:43) at runInTestZone (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:555:34) at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:570:20) at <Jasmine>
Steps to reproduce the issue: That's my test configuration: `beforeEach( waitForAsync(() => { TestBed.configureTestingModule({ declarations: [RuleDefinitionManagementComponent], imports: [ CoreTestingModule.withConfig(), ThemeSharedTestingModule.withConfig(), RuleModule, NgxValidateCoreModule, VALIDATION_BLUEPRINTS ], providers: [] }).compileComponents(); }) );
beforeEach(() => { fixture = TestBed.createComponent(RuleDefinitionManagementComponent); fixture.detectChanges(); });
it("should be initiated", () => { // expect(fixture.componentInstance.ruleDefinitionToDisplay).toEqual(ruleDefinitionMock); expect(fixture.componentInstance).toBeTruthy(); });`
RuleModule includes @NgModule for Rules.
That are my injections in TS class: private ruleService = inject(RuleService); private ruleDataModelService = inject(RuleDataModelService); private ruleDefinitionService = inject(RuleDefinitionService); private ruleUtils = inject(RuleUtils); private generalUtils = inject(GeneralUtils); private formBuilder = inject(FormBuilder); private toast = inject(ToasterService); private router = inject(Router); private localizationService = inject(LocalizationService); private confirmation = inject(ConfirmationService); private constants = inject(Constants); private location = inject(Location);