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

Jest: unhandled promise rejection #6365

Closed
tim-lai opened this issue Sep 8, 2020 · 1 comment · Fixed by #6495
Closed

Jest: unhandled promise rejection #6365

tim-lai opened this issue Sep 8, 2020 · 1 comment · Fixed by #6495

Comments

@tim-lai
Copy link
Contributor

tim-lai commented Sep 8, 2020

Q&A (please complete the following information)

  • OS: [e.g. macOS]
  • Browser: [e.g. chrome, safari]
  • Version: [e.g. 22]
  • Method of installation: [e.g. npm, dist assets]
  • Swagger-UI version: [e.g. 3.10.0]
  • Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]

Content & configuration

Existing Jest unit test. /test/unit/core/plugins/auth/actions.js

Describe the bug you're encountering

The unit tests pass, however there are UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'newAuthErr' of undefined

(node:48945) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'newAuthErr' of undefined
(node:48945) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)

This might be a problem with the Jest test itself, e.g. not configuring/mocking errActions method.

To reproduce...

Steps to reproduce the behavior:

  1. (Optional) Run single Jest unit test file via testMatch: ['**/test/unit/core/plugins/auth/actions.js'],
  2. See error above

Expected behavior

There should be no UnhandledPromiseRejectionWarning

Screenshots

Additional context or thoughts

@tmarkovic
Copy link
Contributor

I have a fix ready for this!

tmarkovic pushed a commit to tmarkovic/swagger-ui that referenced this issue Oct 9, 2020
tim-lai pushed a commit that referenced this issue Oct 15, 2020
…tions #6365 (#6495)

Co-authored-by: Theo Markovic <theodore.markovic@svenskaspel.se>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants