2

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 "cannot find module" errors, but ng serve seems to run quite happily.

Any direction or further reading is appreciated.

EDIT: I think what's further confusing me here is that the error is "cannot find module" but these aren't modules, they're just interfaces or utility functions.

Ray
  • 3,864
  • 7
  • 24
  • 36
Trattles
  • 647
  • 1
  • 6
  • 21

0 Answers0