jeudi 13 septembre 2018

NG Test errors with "cannot find module..."

So I've inherited an Angular 6 project that's fairly large. Everything runs fine via ng serve, however when I try and run ng test I receive a litany of errors indicating that it cannot find a module.

src/app/shared/services/view-as.service.ts(4,24): error TS2307: Cannot find module 'src/app/shared/models/view-as.model' src/app/shared/services/service-type.service.ts(3,44): error TS2307: Cannot find module '@xyz/core'.

There are many more but those seem to be the main types.

So the first is simply a typescript interface that's exported out of that file. The second @xyz/core is a large file with various export * from ... statements pulling a bunch of utility classes/functions. It is present in tsconfig.json under "paths":{ "@xyz/core":['path/to/indexfile']}

I can't for the life of me figure out why ng test dumps a bunch of "can not find module" errors, but ng serve seems to run quite happily.

Any direction or further reading is appreciated.

Aucun commentaire:

Enregistrer un commentaire