-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
While testing with Jest 29, zone.js prints an Unhandled Promise rejection using firstValueFrom #49110
Comments
Hi jordibaliellas: In my opnion, it is not bug with zone.js. zone.js could only patch the rxjs operators but not the app created by testbed. Basically, So i think a unhandled err warning by zone.js at this time is reasonable. |
Hi, Sorry, I do think this is something on this package: If I use I also tried this without angular, only jest and rxjs and works perfectly. It must be the update of Thank you! |
Close angular#49110 In jest 29, should disable uncaught error console.log.
I created a PR to remove the |
Hi, I do not expect that, a console.error / log is okay if the error is uncaught but in my example it is caught on the test. |
@jordibaliellas , yeah, this is a behavior changes seems to related to the |
@JiaLiPassion is definitely that, if I change the |
Close angular#49110 From jest 29 and jest-preset-angular v13, the module transform logic changed, and now jest-preset-angular use the use the tsconfig target other than the hardcoded one, thymikee/jest-preset-angular#2010 But jest-angular-preset doesn't introduce the @babel/plugin-transform-async-to-generator which is needed by angular since `async/await` still need to be transformed to promise for ES2017+ target. So for now, we disable to output the uncaught error console log for a temp solution, until jest-preset-angular find a proper solution.
Close angular#49110 From jest 29 and jest-preset-angular v13, the module transform logic changed, and now jest-preset-angular use the use the tsconfig target other than the hardcoded one, thymikee/jest-preset-angular#2010 But jest-angular-preset doesn't introduce the @babel/plugin-transform-async-to-generator which is needed by angular since `async/await` still need to be transformed to promise for ES2017+ target. So for now, we disable to output the uncaught error console log for a temp solution, until jest-preset-angular find a proper solution.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
zone.js
Is this a regression?
Yes
Description
I use Jest for the app testing.
After updating Jest 28 to 29 I found this issue:
I have this function on the app component:
and I have this test on the spec file:
Using Jest 28 it works perfect, but If I update to Jest 29 Zone.js prints a console.error like the promise was unhandled but as you can see on the test I handle the promise.
The test passes, but the console.error is annoying.
Please, read the anything else part to see my jest configuration. To compare between Jest versions you can execute:
npm uninstall jest jest-preset-angular @types/jest
Jest 29 try:
npm install --save-dev jest jest-preset-angular@next @types/jest
Jest 28 try:
npm install --save-dev jest jest-preset-angular @types/jest
Thanks!
Please provide a link to a minimal reproduction of the bug
example-project
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
Using Jest 29 for testing:
jest.config.ts file:
setup-jest.ts file:
The text was updated successfully, but these errors were encountered: