Using barrels in Angular causes jest circular dependency errors

104 Views Asked by At

I am trying to introduce barrel files into a large scale Angular project. Everything works fine after the introduction. The app works without errors both in dev and prod mode. However, tests start to fail (using jest), caused by a circular dependency error. I have tracked the error down to the import of the module in the barrel.

This works:

// index.ts
export * from './some.service';
export * from './other.component';

This breaks:

// index.ts
export * from './this.module';
export * from './some.service';
export * from './other.component';

I am happy to provide further infos, but I am currently clueless what additional info might be helpful. Has anyone seen a similar behaviour using Angular and Jest?

0

There are 0 best solutions below