lundi 13 janvier 2020

Using JEST to run Angular component test gives cannot find module

Using Jest for the first time. Used the following code to initialze a component testing:

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

beforeEach(async(() => {
  TestBed.configureTestingModule({
      declarations: [ CreateQuoteComponent ]
  });
  fixture = TestBed.createComponent(CreateQuoteComponent);
  component = fixture.componentInstance;
}));

test('should exist', () => {
  expect(component).toBeDefined();
});

});

When running, for some of the imports in the component gives 'Test suite failed to run Cannot find module' with ' at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:259:17) at Object. (src/app/modules/xxx/components/landing/create/create.component.ts:19:1)

any leads for this or is there is a known workaround?

Thans in advanced

Aucun commentaire:

Enregistrer un commentaire