From 862056babbfac8b33b74f2d4a0c0acf02180eadf Mon Sep 17 00:00:00 2001 From: n4l5u0r <59141606+n4l5u0r@users.noreply.github.com> Date: Sat, 30 Nov 2024 12:43:34 +0100 Subject: [PATCH] test: optimized execution --- tests/jest.config.js | 2 ++ tests/src/eth/v5/swap_on_uniswap.test.ts | 13 +++++++++++++ tests/src/eth/v5/swap_on_uniswap_fork_2.test.ts | 13 +++++++++++++ tests/src/test.fixture.ts | 5 +---- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/tests/jest.config.js b/tests/jest.config.js index f6487c9..438560d 100644 --- a/tests/jest.config.js +++ b/tests/jest.config.js @@ -3,5 +3,7 @@ module.exports = { testEnvironment: "node", preset: 'ts-jest', bail: false, + maxWorkers: 1, transformIgnorePatterns: ['^.+\\.js$'], + //testMatch: ['**/eth/v4/simple_swap.v4.test.ts','**/eth/v5/swap_on_zero_v4.test.ts','**/eth/v5/multi_swap.test.ts'], }; diff --git a/tests/src/eth/v5/swap_on_uniswap.test.ts b/tests/src/eth/v5/swap_on_uniswap.test.ts index 40f7bc6..f3ddd59 100644 --- a/tests/src/eth/v5/swap_on_uniswap.test.ts +++ b/tests/src/eth/v5/swap_on_uniswap.test.ts @@ -15,11 +15,24 @@ const devices = [ label: "Nano S", steps: 9 // <= Define the number of steps for this test case and this device }, + { + name: "nanosp", + label: "Nano S+", + steps: 5 // <= Define the number of steps for this test case and this device + }, { name: "nanox", label: "Nano X", steps: 5 // <= Define the number of steps for this test case and this device }, + { + name: "stax", + label: "Stax", + }, + { + name: "flex", + label: "Flex", + }, ]; devices.forEach((device) => diff --git a/tests/src/eth/v5/swap_on_uniswap_fork_2.test.ts b/tests/src/eth/v5/swap_on_uniswap_fork_2.test.ts index 03f3e90..6fc4ed9 100644 --- a/tests/src/eth/v5/swap_on_uniswap_fork_2.test.ts +++ b/tests/src/eth/v5/swap_on_uniswap_fork_2.test.ts @@ -15,10 +15,23 @@ const devices = [ label: "Nano S", steps: 7 // <= Define the number of steps for this test case and this device }, + { + name: "nanosp", + label: "Nano S+", + steps: 6 // <= Define the number of steps for this test case and this device + }, { name: "nanox", label: "Nano X", steps: 6 // <= Define the number of steps for this test case and this device + }, + { + name: "stax", + label: "Stax", + }, + { + name: "flex", + label: "Flex", } ]; diff --git a/tests/src/test.fixture.ts b/tests/src/test.fixture.ts index 0ae1e37..89780d5 100644 --- a/tests/src/test.fixture.ts +++ b/tests/src/test.fixture.ts @@ -55,9 +55,6 @@ beforeAll(async () => { await Zemu.checkAndPullImage(); }); -afterAll(async () => { - await Zemu.stopAllEmuContainers(); -}); jest.setTimeout(1000 * 60 * 60); @@ -206,7 +203,7 @@ async function processTransaction(eth, sim, steps, label, rawTxHex, srlTx = "") * @param {string} rawTxHex RawTx Hex to test * @param {boolean} signed The plugin is already signed and existing in Ledger database */ -function processTest(device, contractName, testLabel, testDirSuffix, rawTxHex, signed, serializedTx, testNetwork) { +async function processTest(device, contractName, testLabel, testDirSuffix, rawTxHex, signed, serializedTx, testNetwork) { test( "[" + contractName + "] - " + device.label + " - " + testLabel, zemu(device.name, async (sim, eth) => {