Typeorm and Jest are throwing 'No metadata for "User" was found.' for unknown reason
See original GitHub issueIssue type:
[x] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [x] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo
TypeORM version:
[ ] latest [ ] @next [x] 0.2.34 (or put your version here)
Steps to reproduce or a small repository showing the problem:
So, I got this ‘project’ and it works when in production or development. In ormconfig.js I’ve set the entities/migrations folder to follow the environment, if it’s production, it will get from dist/ folder, otherwise, it’s from src/ folder. Checking the repository, you will see a docker-compose file for db-only, and that’s fine when in prod/dev, but when I try to run THIS test, it doesn’t throw error when connecting, but it’s not able to find the entities, I guess and then I get this error:
Error 'No metadata for "User" was found.'
It doesn’t matter whether I set the env to test or not, I get the same error.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Related StackOverflow Question
Thanks harshrawat66.
I am using Nestjs and the following solution works. Modify the files as shown below
tasks.repository.ts
tasks.module.ts
tasks.service.ts