Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InjectRepository fails when running test #67

Closed
osmanmesutozcan opened this issue Mar 9, 2019 · 7 comments
Closed

InjectRepository fails when running test #67

osmanmesutozcan opened this issue Mar 9, 2019 · 7 comments

Comments

@osmanmesutozcan
Copy link

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:

@kamilmysliwiec
Copy link
Member

Please, provide a minimal repository which reproduces your issue.

@osmanmesutozcan
Copy link
Author

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

@rcanessa89
Copy link

Looks more like a Jest configuration problem

@kamilmysliwiec
Copy link
Member

Sounds like you were passing undefined to @InjectRepository. I added an additional check in 6.1.0

@angel-carvajal
Copy link

Would you guys give more detail of this? I'm having this problem. How do we fix that?

@wm4tos
Copy link

wm4tos commented Feb 13, 2020

Same problem here... Some solution?

@kamilmysliwiec
Copy link
Member

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.

@nestjs nestjs locked as resolved and limited conversation to collaborators Feb 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants