-
Notifications
You must be signed in to change notification settings - Fork 306
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
Tests are hanging when you do not provide a service mock or stub for a component #527
Comments
Your issue does solve when I use the That said I do not believe it is related to |
@wtho thank you for coming back to me so quickly. Sorry I forgot to mention that with the flag runInBand it works. I have tried so many things, and forgot to mention it, though I think this is not the solution because for me the biggest point of migrating to jest is the speed that it provides, allowing tests to run in parallel. I mentioned the emitDecoratorData because as soon as you remove that, the tests stop after the failure, though with a different issue. I thought the emitDecoratorData was more of a workaround based on that thread I mentioned. I really don't know what is causing it except by knowing that with a specific version of Jest it used to work. I am gonna try and use an older version of jest to try and reproduce this error. If you think this is not related to the preset, I am happy to close this issue. Thanks in advance. |
@wtho I have downgraded the version of Jest from 26.4.2 to 25.5.4 and the problem no longer happens. I'll close the issue as this does not seem to be related to the preset. Thank you for your help. |
FYI similar issue was reported in jest repo jestjs/jest#10577 |
Hi @ahnpnl, yes I looked at it this morning. The person seemed to be able to trace it back to 26.3.0. I was able to trace it back to working on 26.0.1 and not working from 26.1.0 onwards. The only reason why I know that is because the package-lock.json was stamped with 26.0.1, and when deleting package-lock.json, the version 26.0.1 was on the dependant packages. It is very difficult to understand the package-lock.json fully, but I saw this on @jest/core on my old package lock.
If you assign jest to
I'll mention my issue there but it might be a different problem. I have created another branch https://github.com/gustavobmichel/angular-jest-hanging-tests/tree/jest-v25 showing that it used to work on Jest 25. If you have any other suggestions, please let me know. For the meantime, I am gonna raise an issue with Jest and have to keep using Jest 25. Thanks for your help. |
Ok, thanks for confirming its source is not in our project. |
I'm having the same issue. Hopefully they'll fix this soon! |
🐛 Bug Report
Hello, I believe I might have an issue that is a side effect of setting
"emitDecoratorMetadata": true
. #288I created a simple component that injects two services - to test exactly
Can't resolve all parameters
issue. One of them is an api service that will call on HttpClient. As soon as I add this setting to thetsconfig.spec.json
the tests will enter into a hanging status.I first noticed it when moving from Jest 26.0.1 and Jest-Preset-Angular 8.2.0. I am pretty sure this is related to an upgrade because once I rolled back to this exact version alongside its dependencies, and this problem no longer exists.
This repository was created today with the latest versions of Jest and Jest-Preset-Angular using this article as a guide, though
tsconfig.spec.json
has been updated to reflect Angular guideline to extend a base tsconfig andjest.config.js
has been updated becausesetupJest.ts
has been renamed tosetup-jest.ts
.To Reproduce
Download code from repository and run
npm install
andng test
.The elapsed time on the error log will keep going indefinitely.
Once you remove the comment from line 13 on
test.component.spec.ts
, tests are executed.Expected behavior
Test would fail because the stub/mock was not provided or there is no relevant method on the mock used by the component.
Link to repo (highly encouraged)
https://github.com/gustavobmichel/angular-jest-hanging-tests
Error log:
envinfo
The text was updated successfully, but these errors were encountered: