Skip to content

Commit

Permalink
We can run 35 of our e2e tests just using jest.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlielye committed Apr 9, 2024
1 parent a5a9260 commit 9a804dd
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"node": ">=18"
},
"jest": {
"slowTestThreshold": 180,
"slowTestThreshold": 300,
"extensionsToTreatAsEsm": [
".ts"
],
Expand Down
6 changes: 1 addition & 5 deletions yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_fees.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
9 changes: 5 additions & 4 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ const {
TEMP_DIR = '/tmp',
ACVM_BINARY_PATH = '',
ACVM_WORKING_DIRECTORY = '',
ENABLE_GAS = '',
} = process.env;

const getAztecUrl = () => {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -322,6 +322,7 @@ export async function setup(
numberOfAccounts = 1,
opts: SetupOptions = {},
pxeOpts: Partial<PXEServiceConfig> = {},
enableGas = false,
): Promise<EndToEndContext> {
const config = { ...getConfigEnvVars(), ...opts };

Expand Down Expand Up @@ -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 =
Expand All @@ -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.`);
Expand Down

0 comments on commit 9a804dd

Please sign in to comment.