diff --git a/.changeset/pink-apricots-sell.md b/.changeset/pink-apricots-sell.md new file mode 100644 index 00000000000..0149e9a4bde --- /dev/null +++ b/.changeset/pink-apricots-sell.md @@ -0,0 +1,4 @@ +--- +--- + +chore: fixing flaky tests diff --git a/packages/account/src/test-utils/launchNode.test.ts b/packages/account/src/test-utils/launchNode.test.ts index 2445f8b77c4..46091a0ef8f 100644 --- a/packages/account/src/test-utils/launchNode.test.ts +++ b/packages/account/src/test-utils/launchNode.test.ts @@ -28,7 +28,7 @@ vi.mock('fs', async () => { /** * @group node */ -describe('launchNode', { timeout: 10000 }, () => { +describe('launchNode', () => { test('using ephemeral port 0 is possible', async () => { const { cleanup, port, url } = await launchNode({ port: '0' }); expect(await fetch(url)).toBeTruthy(); @@ -116,7 +116,7 @@ describe('launchNode', { timeout: 10000 }, () => { cleanup(); }); - test('should throw on error and log error message', async () => { + test('should throw on error and log error message', { timeout: 15000 }, async () => { const logSpy = vi.spyOn(console, 'log'); const invalidCoin = { diff --git a/packages/fuel-gauge/src/contract-factory.test.ts b/packages/fuel-gauge/src/contract-factory.test.ts index ac964b70a73..128f46a2265 100644 --- a/packages/fuel-gauge/src/contract-factory.test.ts +++ b/packages/fuel-gauge/src/contract-factory.test.ts @@ -292,33 +292,37 @@ describe('Contract Factory', () => { expect(value.toNumber()).toBe(1001); }, 15000); - it('deploys large contracts via blobs and awaits transaction id', async () => { - using launched = await launchTestNode({ - nodeOptions: { - args: ['--tx-pool-ttl', '1s'], - }, - providerOptions: { - resourceCacheTTL: -1, - }, - }); - - const { - wallets: [wallet], - } = launched; - - const factory = new ContractFactory(LargeContractFactory.bytecode, LargeContract.abi, wallet); - const deploy = await factory.deployAsBlobTx(); - const initTxId = deploy.waitForTransactionId(); - expect(initTxId).toStrictEqual(new Promise(() => {})); - const { contract } = await deploy.waitForResult(); - expect(contract.id).toBeDefined(); - const awaitTxId = await deploy.waitForTransactionId(); - expect(awaitTxId).toBeTruthy(); - - const call = await contract.functions.something().call(); - const { value } = await call.waitForResult(); - expect(value.toNumber()).toBe(1001); - }); + it( + 'deploys large contracts via blobs and awaits transaction id', + { timeout: 15000 }, + async () => { + using launched = await launchTestNode({ + nodeOptions: { + args: ['--tx-pool-ttl', '1s'], + }, + providerOptions: { + resourceCacheTTL: -1, + }, + }); + + const { + wallets: [wallet], + } = launched; + + const factory = new ContractFactory(LargeContractFactory.bytecode, LargeContract.abi, wallet); + const deploy = await factory.deployAsBlobTx(); + const initTxId = deploy.waitForTransactionId(); + expect(initTxId).toStrictEqual(new Promise(() => {})); + const { contract } = await deploy.waitForResult(); + expect(contract.id).toBeDefined(); + const awaitTxId = await deploy.waitForTransactionId(); + expect(awaitTxId).toBeTruthy(); + + const call = await contract.functions.something().call(); + const { value } = await call.waitForResult(); + expect(value.toNumber()).toBe(1001); + } + ); it('deploys large contracts via blobs [padded]', async () => { using launched = await launchTestNode({