1
0
mirror of https://github.com/lensapp/lens.git synced 2024-09-20 13:57:23 +03:00

Make jest not crash totally when encountering non handled exception (#5634)

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2022-06-16 02:37:22 +03:00 committed by GitHub
parent 6451df1f17
commit fa32aa1b8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,10 @@ globalThis.__non_webpack_require__ = jest.fn();
global.setImmediate = global.setImmediate ?? (<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs) => setTimeout(() => callback(...args), 0));
global.fail = ((error = "Test failed without explicit error") => {
console.error(error);
}) as any;
process.on("unhandledRejection", (err: any) => {
fail(err);
global.fail(err);
});