-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Jest Resolver Plugin Doesn't Return Full Path #2418
Comments
Hi @JakeAi, I cloned your repo and follow the steps you provided and got this as my output:
There's two things I notice:
Is there anything else you can provide? For example, Node version, OS version, etc. |
I think this can be closed. If you can provide more info about this, we can reopen. |
why closed? this is happening. It took me a lot of time to investigate the weird behaviour. Basically when you mix relative and absolute imports, then the same module will be loaded twice, which means some variables in the module will be read as different values. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Please make sure you have read the submission guidelines before posting an issue
https://github.com/nrwl/nx/blob/master/packages/jest/plugins/resolver.ts
Jest resolver plugin doesn't return full path. It needs to resolve the actual fqn of the path instead of a partial. This causes Jest to load the same file twice. Once it is required using a relative path ( "./" ), and once when it's required using an alias. ("@mono-api")
Expected Behavior
Files to not be loaded twice.
Current Behavior
Files are being loaded twice causing problems.
Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
These two lines means the pre save hook is being called twice due to the resolver. When compiling the code to js and running jest it works as intended. The hook takes the password, hashes it, sets
this.password
to the hash, then it gets called again which hashes the hashed password. Refer to the linked issue for more information.kpfromer/nestjs-typegoose#61
Context
Please provide any relevant information about your setup:
@nrwl/angular : 8.12.0
@nrwl/cli : 8.12.0
@nrwl/cypress : 8.12.0
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : 8.12.0
@nrwl/jest : 8.12.0
@nrwl/linter : 8.12.0
@nrwl/nest : 8.12.0
@nrwl/next : Not Found
@nrwl/node : 8.12.0
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 8.12.0
@nrwl/web : Not Found
@nrwl/workspace : 8.12.0
typescript : 3.5.3
Other
kpfromer/nestjs-typegoose#61
The text was updated successfully, but these errors were encountered: