getsaf / shallow-render

Angular testing made easy with shallow rendering and easy mocking. https://getsaf.github.io/shallow-render
MIT License
273 stars 25 forks source link

Error: Can't export directive MockOfSearchPopupComponent from ShallowTestModule as it was neither declared nor imported! #192

Closed azaeng04 closed 3 years ago

azaeng04 commented 3 years ago

Any reason why I would be receiving this error? I am trying to test an Angular service.

getsaf commented 3 years ago

One of your modules has something named SearchPopupComponent that is in the exports section of the @NgModule config but is not in the declarations section.

azaeng04 commented 3 years ago

This is the module and it seems to only be under the entryComponents?

@NgModule({
    imports: [
        ReactiveFormsModule,
        HttpClientModule,
        CommonModule,
        CalendarModule,
        CoreRoutes,
        SharedModule,
    ],
    entryComponents: [
        HierarchyComponent,
        SearchPopupComponent,
        FilterPopupComponent,
        SaveSearchPopupComponent,
        ManageSavedSearchesPopupComponent,
        ExportPopupComponent,
        TagPopupComponent,
        TransactionFilterPopupComponent,
        GenericFormPopupComponent,
        GenericFormGroupPopupComponent,
        JsonEditorPopupComponent,
        NdlPopupComponent,
        SelectPopupComponent,
    ],
    declarations: [CoreComponent],
    providers: [
        AdminAuthorisationGuard,
        BapAuthorisationGuard,
        NoAuthGuard,
        RoleInterfaceGuard,
        CanDeactivateGuard,
        FileLimitationResolver,
        ApplicationService,
        BapModelMapping,
        BreadcrumbService,
        DeploymentService,
        GuiRuleService,
        HierarchyService,
        MenuService,
        RbacService,
        ReactiveFormService,
        RoutingStateService,
        StaticDataService,
        SearchService,
        TemplateService,
        TransactionService,
        VossDialogService,
        UtilsService,
    ],
})
azaeng04 commented 3 years ago

Thanks @getsaf that actually helped!