From 9a804dd321320ac0bfa5e27ba05251fc944bad20 Mon Sep 17 00:00:00 2001 From: Charlie Lye Date: Mon, 8 Apr 2024 09:11:26 +0000 Subject: [PATCH] We can run 35 of our e2e tests just using jest. --- yarn-project/end-to-end/package.json | 2 +- ..._js_browser.test.ts => _e2e_aztec_js_browser.test.ts} | 0 ...{e2e_persistence.test.ts => _e2e_persistence.test.ts} | 0 ...dbox_example.test.ts => _e2e_sandbox_example.test.ts} | 0 .../end-to-end/src/e2e_dapp_subscription.test.ts | 6 +----- yarn-project/end-to-end/src/e2e_fees.test.ts | 2 +- yarn-project/end-to-end/src/fixtures/utils.ts | 9 +++++---- 7 files changed, 8 insertions(+), 11 deletions(-) rename yarn-project/end-to-end/src/{e2e_aztec_js_browser.test.ts => _e2e_aztec_js_browser.test.ts} (100%) rename yarn-project/end-to-end/src/{e2e_persistence.test.ts => _e2e_persistence.test.ts} (100%) rename yarn-project/end-to-end/src/{e2e_sandbox_example.test.ts => _e2e_sandbox_example.test.ts} (100%) diff --git a/yarn-project/end-to-end/package.json b/yarn-project/end-to-end/package.json index b5df23580ee..8087a1be253 100644 --- a/yarn-project/end-to-end/package.json +++ b/yarn-project/end-to-end/package.json @@ -102,7 +102,7 @@ "node": ">=18" }, "jest": { - "slowTestThreshold": 180, + "slowTestThreshold": 300, "extensionsToTreatAsEsm": [ ".ts" ], diff --git a/yarn-project/end-to-end/src/e2e_aztec_js_browser.test.ts b/yarn-project/end-to-end/src/_e2e_aztec_js_browser.test.ts similarity index 100% rename from yarn-project/end-to-end/src/e2e_aztec_js_browser.test.ts rename to yarn-project/end-to-end/src/_e2e_aztec_js_browser.test.ts diff --git a/yarn-project/end-to-end/src/e2e_persistence.test.ts b/yarn-project/end-to-end/src/_e2e_persistence.test.ts similarity index 100% rename from yarn-project/end-to-end/src/e2e_persistence.test.ts rename to yarn-project/end-to-end/src/_e2e_persistence.test.ts diff --git a/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts b/yarn-project/end-to-end/src/_e2e_sandbox_example.test.ts similarity index 100% rename from yarn-project/end-to-end/src/e2e_sandbox_example.test.ts rename to yarn-project/end-to-end/src/_e2e_sandbox_example.test.ts diff --git a/yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts b/yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts index 90348fa8d28..a00584b76ad 100644 --- a/yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts +++ b/yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts @@ -22,12 +22,8 @@ import { } from '@aztec/noir-contracts.js'; import { getCanonicalGasTokenAddress } from '@aztec/protocol-contracts/gas-token'; -import { jest } from '@jest/globals'; - import { type BalancesFn, expectMapping, getBalancesFn, publicDeployAccounts, setup } from './fixtures/utils.js'; -jest.setTimeout(100_000); - const TOKEN_NAME = 'BananaCoin'; const TOKEN_SYMBOL = 'BC'; const TOKEN_DECIMALS = 18n; @@ -66,7 +62,7 @@ describe('e2e_dapp_subscription', () => { let wallets: AccountWalletWithPrivateKey[]; let aztecNode: AztecNode; let deployL1ContractsValues: DeployL1Contracts; - ({ wallets, aztecNode, deployL1ContractsValues, logger, pxe } = await setup(3)); + ({ wallets, aztecNode, deployL1ContractsValues, logger, pxe } = await setup(3, {}, {}, true)); await publicDeployAccounts(wallets[0], wallets); diff --git a/yarn-project/end-to-end/src/e2e_fees.test.ts b/yarn-project/end-to-end/src/e2e_fees.test.ts index 7aed8e282eb..ec85175bd1a 100644 --- a/yarn-project/end-to-end/src/e2e_fees.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees.test.ts @@ -54,7 +54,7 @@ describe('e2e_fees', () => { let bananaPrivateBalances: BalancesFn; beforeAll(async () => { - const { wallets: _wallets, aztecNode, deployL1ContractsValues, logger, pxe } = await setup(3); + const { wallets: _wallets, aztecNode, deployL1ContractsValues, logger, pxe } = await setup(3, {}, {}, true); wallets = _wallets; await aztecNode.setConfig({ diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index b4f492919a2..1faa9ac4951 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -78,7 +78,6 @@ const { TEMP_DIR = '/tmp', ACVM_BINARY_PATH = '', ACVM_WORKING_DIRECTORY = '', - ENABLE_GAS = '', } = process.env; const getAztecUrl = () => { @@ -222,6 +221,7 @@ async function setupWithRemoteEnvironment( config: AztecNodeConfig, logger: DebugLogger, numberOfAccounts: number, + enableGas: boolean, ) { // we are setting up against a remote environment, l1 contracts are already deployed const aztecNodeUrl = getAztecUrl(); @@ -259,7 +259,7 @@ async function setupWithRemoteEnvironment( const cheatCodes = CheatCodes.create(config.rpcUrl, pxeClient!); const teardown = () => Promise.resolve(); - if (['1', 'true'].includes(ENABLE_GAS)) { + if (enableGas) { // this contract might already have been deployed // the following function is idempotent await deployCanonicalGasToken(new SignerlessWallet(pxeClient, new DefaultMultiCallEntrypoint())); @@ -322,6 +322,7 @@ export async function setup( numberOfAccounts = 1, opts: SetupOptions = {}, pxeOpts: Partial = {}, + enableGas = false, ): Promise { const config = { ...getConfigEnvVars(), ...opts }; @@ -354,7 +355,7 @@ export async function setup( if (PXE_URL) { // we are setting up against a remote environment, l1 contracts are assumed to already be deployed - return await setupWithRemoteEnvironment(hdAccount, config, logger, numberOfAccounts); + return await setupWithRemoteEnvironment(hdAccount, config, logger, numberOfAccounts, enableGas); } const deployL1ContractsValues = @@ -377,7 +378,7 @@ export async function setup( logger('Creating a pxe...'); const { pxe, wallets } = await setupPXEService(numberOfAccounts, aztecNode!, pxeOpts, logger); - if (['1', 'true'].includes(ENABLE_GAS)) { + if (enableGas) { logger(`Deploying canonical gas token...`); await deployCanonicalGasToken(new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint())); logger(`Done.`);