UnhandledPromiseRejectionWarning in unit tests
It seems a portion of the frontend unit tests was not actually run when using the assertRejects
test helper, instead displaying a UnhandledPromiseRejectionWarning
:
(node:25815) UnhandledPromiseRejectionWarning: Error: Request failed with status code 500
at createAxiosError (frontend/node_modules/axios-mock-adapter/src/utils.js:147:15)
at Object.settle (frontend/node_modules/axios-mock-adapter/src/utils.js:126:9)
at handleRequest (frontend/node_modules/axios-mock-adapter/src/handle_request.js:67:13)
at frontend/node_modules/axios-mock-adapter/src/index.js:26:9
at new Promise (<anonymous>)
at MockAdapter.<anonymous> (frontend/node_modules/axios-mock-adapter/src/index.js:25:14)
at frontend/test/testhelpers.js:133:1
at dispatchRequest (frontend/node_modules/axios/lib/core/dispatchRequest.js:52:10)
(node:25815) 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(). (rejection id: 153)
!720 (merged) changed the test runner which apparently caused those non-executed portions to actually be executed, causing a single test to fail. However, those warnings are still present.
assertRejects
is an async function and does have a catch block. Converting it to a Promise still displays the warnings. Using npm install --save-dev assert
to get assert.rejects
does not change anything. Google does not tell me anything interesting.