InjectRepository fails when running test
I'm submitting a...
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
@InjectRepository fails with 'TypeError: Right-hand side of 'instanceof' is not an object'. when yarn test
Expected behavior
Minimal reproduction of the problem with instructions
https://github.com/osmanmesutozcan/nestjs-inject-repository-bug-repro
to run it:
yarn
yarn test
What is the motivation / use case for changing the behavior?
Environment
Nest version:
"@nestjs/common": "^5.4.0",
"@nestjs/core": "^5.4.0",
"@nestjs/graphql": "^5.5.7",
"@nestjs/typeorm": "^5.3.0",
For Tooling issues:
- Node version: 10.12.0
- Platform: Linux
Others:
Please, provide a minimal repository which reproduces your issue.
Hey @kamilmysliwiec. I actually did add an example repository. Let me know if it needs some more clarification.
yarn test should pop an error message
Looks more like a Jest configuration problem
Sounds like you were passing undefined to @InjectRepository. I added an additional check in 6.1.0
Would you guys give more detail of this? I'm having this problem. How do we fix that?
Same problem here... Some solution?
I would suggest avoiding barrel files (index.ts). This may cause some side-effects, leading to classes being represented as undefined. It's especially important when it comes to jest and it's path resolution mapper.