dividab / tsconfig-paths

Load node modules according to tsconfig paths, in run-time or via API.
MIT License
1.82k stars 104 forks source link

jest e2e test #164

Open wmvm0 opened 3 years ago

wmvm0 commented 3 years ago

How do use this in unit tests ?

Cannot find module '@apps/funning/jd/pet/dto/enum' from 'src/apps/funning/jd/pet/service/impl/pet.service.ts'

Cannot resolve the configured path

spk-cpsamut commented 2 years ago

I also face this problem. Do you solve this?

AndyClausen commented 2 years ago

As a workaround, you can add this to your jest config:

  moduleNameMapper: {
    '@apps/(.*)': '<rootDir>/src/apps/$1',
  },

Of course, replace apps with whatever you need to point to