Skip to content

Unexpected value 'NgxJdenticonModule' imported by the module 'DynamicTestModule' #10

@triadzack

Description

@triadzack

I just updated my angular app and I am seeing this issue when I run my unit tests

Unexpected value 'NgxJdenticonModule' imported by the module 'DynamicTestModule'. Please add an @NgModule annotation.

Related packages

    "@angular/core": "~13.3.5",
    "jdenticon": "^3.1.1",
    "ngx-jdenticon": "^1.0.4",

    "@angular-builders/jest": "13.0.3",
    "jest": "27.5.1",

I looked at the NgxJdenticonModule source and it seems to have an "@NgModule annotation." so I'm not sure whats going on.

The unit test is simple enough

import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { NgxJdenticonModule } from 'ngx-jdenticon';

import { CandidateAvatarComponent } from './candidate-avatar.component';

describe('CandidateAvatarComponent', () => {
    let component: CandidateAvatarComponent;
    let fixture: ComponentFixture<CandidateAvatarComponent>;

    beforeEach(
        waitForAsync(() => {
            TestBed.configureTestingModule({
                declarations: [CandidateAvatarComponent],
                imports: [NgxJdenticonModule],
                schemas: [CUSTOM_ELEMENTS_SCHEMA],
                teardown: { destroyAfterEach: false },
            }).compileComponents();
        })
    );

    beforeEach(() => {
        fixture = TestBed.createComponent(CandidateAvatarComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

    it('CandidateAvatarComponent: should create', () => {
        expect(component).toBeTruthy();
    });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions