From 11188ee272f116468868a127b0328b157b1e152b Mon Sep 17 00:00:00 2001 From: Tomas Martykan Date: Tue, 3 Dec 2024 10:02:32 +0100 Subject: [PATCH] test(connect): ignore disposed error in tests --- packages/connect/e2e/jest.setup.js | 16 ++++++++++++++++ packages/connect/e2e/tests/api/init.test.ts | 6 +++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/connect/e2e/jest.setup.js b/packages/connect/e2e/jest.setup.js index 1a146f172afd..de53750e1810 100644 --- a/packages/connect/e2e/jest.setup.js +++ b/packages/connect/e2e/jest.setup.js @@ -13,6 +13,22 @@ if (process.env.TESTS_USE_WS_CACHE === 'true') { }); } +console.log('Jest setup loaded'); + +process.on('unhandledRejection', error => { + console.error('unhandledRejection', error); + if (error.message === 'Disposed') { + // Ignored + return; + } + throw error; +}); + +process.on('uncaughtException', error => { + console.error('uncaughtException', error); + throw error; +}); + global.TestUtils = { ...global.TestUtils, TX_CACHE, diff --git a/packages/connect/e2e/tests/api/init.test.ts b/packages/connect/e2e/tests/api/init.test.ts index 450e66e8f1f1..0fc3ee8cacd2 100644 --- a/packages/connect/e2e/tests/api/init.test.ts +++ b/packages/connect/e2e/tests/api/init.test.ts @@ -5,7 +5,11 @@ const INIT_ERROR = { code: 'Init_ManifestMissing' }; describe('TrezorConnect.init', () => { afterEach(() => { - TrezorConnect.dispose(); + try { + TrezorConnect.dispose(); + } catch { + // do nothing + } }); beforeAll(() => {