1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Make jest not crash totally when encountering non handled exception

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2022-06-14 15:04:19 +03:00
parent dc1f1ab7f8
commit 5e4cb488ce
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A

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);
});