From d0828c0fb7a98a3e9561bfb73cbdf0ff4b5700e0 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Tue, 10 Dec 2024 11:11:46 -0300 Subject: [PATCH 1/2] fix: Do not load pino-pretty in production bundles Browser tests were broken since #10459 due to the static import of pino-pretty, which had some browser unfriendly stuff. This PR removes that import in favor of setting it up in a separate jest setup file, only run under jest. This follows the recommendation of pino-pretty of not importing it in production. Note that, for end-users who want pretty logging, pino-pretty will still kick in but as a transport, so it gets loaded in a nodejs worker thread by pino itself, and does not pollute the static imports. Another way of fixing this would have been adding the 'pino-pretty' exception in the webpack fallbacks, but it felt wrong to start adding so many deps in there. Another option would have been to dynamically import (as opposed to statically) pino-pretty, and use a webpackIgnore magic comment to skip it. But it's unclear whether this would have worked with other bundlers, and besides it would have added an async operation to our otherwise synchronous logger setup. --- yarn-project/accounts/package.json | 5 ++++- yarn-project/archiver/package.json | 5 ++++- yarn-project/aztec-faucet/package.json | 5 ++++- yarn-project/aztec-node/package.json | 5 ++++- yarn-project/aztec.js/package.json | 5 ++++- yarn-project/aztec/package.json | 5 ++++- yarn-project/bb-prover/package.json | 5 ++++- yarn-project/bot/package.json | 5 ++++- yarn-project/builder/package.json | 5 ++++- yarn-project/circuit-types/package.json | 5 ++++- yarn-project/circuits.js/package.json | 5 ++++- yarn-project/cli-wallet/package.json | 5 ++++- yarn-project/cli/package.json | 5 ++++- yarn-project/end-to-end/package.json | 5 ++++- yarn-project/end-to-end/src/shared/browser.ts | 2 +- yarn-project/entrypoints/package.json | 5 ++++- yarn-project/epoch-cache/package.json | 5 ++++- yarn-project/ethereum/package.json | 7 +++++-- yarn-project/foundation/package.json | 8 +++++++- yarn-project/foundation/src/jest/setup.mjs | 8 ++++++++ .../foundation/src/log/pino-logger.ts | 20 ++++++++++++++----- yarn-project/ivc-integration/package.json | 5 ++++- yarn-project/key-store/package.json | 5 ++++- yarn-project/kv-store/package.json | 5 ++++- yarn-project/merkle-tree/package.json | 5 ++++- yarn-project/noir-contracts.js/package.json | 5 ++++- .../noir-protocol-circuits-types/package.json | 5 ++++- yarn-project/p2p-bootstrap/package.json | 5 ++++- yarn-project/p2p/package.json | 5 ++++- yarn-project/package.common.json | 5 ++++- yarn-project/proof-verifier/package.json | 5 ++++- yarn-project/protocol-contracts/package.json | 5 ++++- yarn-project/prover-client/package.json | 5 ++++- yarn-project/prover-node/package.json | 5 ++++- yarn-project/pxe/package.json | 5 ++++- yarn-project/scripts/package.json | 5 ++++- yarn-project/sequencer-client/package.json | 5 ++++- yarn-project/simulator/package.json | 5 ++++- yarn-project/telemetry-client/package.json | 5 ++++- yarn-project/txe/package.json | 5 ++++- yarn-project/types/package.json | 5 ++++- yarn-project/validator-client/package.json | 5 ++++- yarn-project/world-state/package.json | 5 ++++- 43 files changed, 188 insertions(+), 47 deletions(-) create mode 100644 yarn-project/foundation/src/jest/setup.mjs diff --git a/yarn-project/accounts/package.json b/yarn-project/accounts/package.json index efa1f66e06ca..7fd731ae2812 100644 --- a/yarn-project/accounts/package.json +++ b/yarn-project/accounts/package.json @@ -72,7 +72,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/aztec.js": "workspace:^", diff --git a/yarn-project/archiver/package.json b/yarn-project/archiver/package.json index c92d80bfe57c..61b844341704 100644 --- a/yarn-project/archiver/package.json +++ b/yarn-project/archiver/package.json @@ -62,7 +62,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", diff --git a/yarn-project/aztec-faucet/package.json b/yarn-project/aztec-faucet/package.json index 9315089fa18b..3852ff8828e9 100644 --- a/yarn-project/aztec-faucet/package.json +++ b/yarn-project/aztec-faucet/package.json @@ -56,7 +56,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/ethereum": "workspace:^", diff --git a/yarn-project/aztec-node/package.json b/yarn-project/aztec-node/package.json index ab293ce4ada8..f23417a5b7be 100644 --- a/yarn-project/aztec-node/package.json +++ b/yarn-project/aztec-node/package.json @@ -58,7 +58,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/archiver": "workspace:^", diff --git a/yarn-project/aztec.js/package.json b/yarn-project/aztec.js/package.json index 0c7447bd644a..f426c02a05d5 100644 --- a/yarn-project/aztec.js/package.json +++ b/yarn-project/aztec.js/package.json @@ -74,7 +74,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", diff --git a/yarn-project/aztec/package.json b/yarn-project/aztec/package.json index 7d98ce7812f9..7e9611f7afbe 100644 --- a/yarn-project/aztec/package.json +++ b/yarn-project/aztec/package.json @@ -110,7 +110,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "engines": { "node": ">=18" diff --git a/yarn-project/bb-prover/package.json b/yarn-project/bb-prover/package.json index 9ea893b29627..9dff8dc8a802 100644 --- a/yarn-project/bb-prover/package.json +++ b/yarn-project/bb-prover/package.json @@ -63,7 +63,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", diff --git a/yarn-project/bot/package.json b/yarn-project/bot/package.json index 1bef173a5904..f2f8c952824b 100644 --- a/yarn-project/bot/package.json +++ b/yarn-project/bot/package.json @@ -50,7 +50,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/accounts": "workspace:^", diff --git a/yarn-project/builder/package.json b/yarn-project/builder/package.json index 602a934a9703..801ccec15f4b 100644 --- a/yarn-project/builder/package.json +++ b/yarn-project/builder/package.json @@ -66,7 +66,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/foundation": "workspace:^", diff --git a/yarn-project/circuit-types/package.json b/yarn-project/circuit-types/package.json index 32e46a6bd57b..e8c4974633e6 100644 --- a/yarn-project/circuit-types/package.json +++ b/yarn-project/circuit-types/package.json @@ -64,7 +64,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuits.js": "workspace:^", diff --git a/yarn-project/circuits.js/package.json b/yarn-project/circuits.js/package.json index ada850753b6c..66d4573bdb0c 100644 --- a/yarn-project/circuits.js/package.json +++ b/yarn-project/circuits.js/package.json @@ -98,6 +98,9 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] } } diff --git a/yarn-project/cli-wallet/package.json b/yarn-project/cli-wallet/package.json index 2d75d430b592..19bc75f4b98d 100644 --- a/yarn-project/cli-wallet/package.json +++ b/yarn-project/cli-wallet/package.json @@ -64,7 +64,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/accounts": "workspace:^", diff --git a/yarn-project/cli/package.json b/yarn-project/cli/package.json index 1165f8b04fb3..ea86f4fdb5d9 100644 --- a/yarn-project/cli/package.json +++ b/yarn-project/cli/package.json @@ -64,7 +64,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/archiver": "workspace:^", diff --git a/yarn-project/end-to-end/package.json b/yarn-project/end-to-end/package.json index 1344ee5de942..c51b89150bbf 100644 --- a/yarn-project/end-to-end/package.json +++ b/yarn-project/end-to-end/package.json @@ -156,6 +156,9 @@ }, "testRegex": "./src/.*\\.test\\.(js|mjs|ts)$", "rootDir": "./src", - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] } } diff --git a/yarn-project/end-to-end/src/shared/browser.ts b/yarn-project/end-to-end/src/shared/browser.ts index c2abd9dca269..8110a6978985 100644 --- a/yarn-project/end-to-end/src/shared/browser.ts +++ b/yarn-project/end-to-end/src/shared/browser.ts @@ -97,7 +97,7 @@ export const browserTestSuite = ( pageLogger.info(msg.text()); }); page.on('pageerror', err => { - pageLogger.error(err.toString()); + pageLogger.error(`Error on web page`, err); }); await page.goto(`${webServerURL}/index.html`); while (!(await page.evaluate(() => !!window.AztecJs))) { diff --git a/yarn-project/entrypoints/package.json b/yarn-project/entrypoints/package.json index bc4b5352b6a3..d335c9079789 100644 --- a/yarn-project/entrypoints/package.json +++ b/yarn-project/entrypoints/package.json @@ -60,7 +60,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/aztec.js": "workspace:^", diff --git a/yarn-project/epoch-cache/package.json b/yarn-project/epoch-cache/package.json index 30ff934d8501..2db4ee09f3e2 100644 --- a/yarn-project/epoch-cache/package.json +++ b/yarn-project/epoch-cache/package.json @@ -87,7 +87,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "engines": { "node": ">=18" diff --git a/yarn-project/ethereum/package.json b/yarn-project/ethereum/package.json index 0e34d8dcbf15..e9d6ec74d23b 100644 --- a/yarn-project/ethereum/package.json +++ b/yarn-project/ethereum/package.json @@ -86,9 +86,12 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "engines": { "node": ">=18" } -} \ No newline at end of file +} diff --git a/yarn-project/foundation/package.json b/yarn-project/foundation/package.json index 36fd1e55a251..1f3bf0f9e97b 100644 --- a/yarn-project/foundation/package.json +++ b/yarn-project/foundation/package.json @@ -97,7 +97,13 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFilesAfterEnv": [ + "../../foundation/src/jest/setup.mjs" + ], + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/bb.js": "portal:../../barretenberg/ts", diff --git a/yarn-project/foundation/src/jest/setup.mjs b/yarn-project/foundation/src/jest/setup.mjs new file mode 100644 index 000000000000..14184256ca4a --- /dev/null +++ b/yarn-project/foundation/src/jest/setup.mjs @@ -0,0 +1,8 @@ +import { overwriteLoggingStream, pinoPrettyOpts } from '@aztec/foundation/log'; +import pretty from 'pino-pretty'; + +// Overwrite logging stream with pino-pretty. We define this as a separate +// file so we don't mess up with dependencies in non-testing environments, +// since pino-pretty messes up with browser bundles. +// See also https://www.npmjs.com/package/pino-pretty?activeTab=readme#user-content-usage-with-jest +overwriteLoggingStream(pretty(pinoPrettyOpts)); \ No newline at end of file diff --git a/yarn-project/foundation/src/log/pino-logger.ts b/yarn-project/foundation/src/log/pino-logger.ts index 10b19086939c..81a6ec951e4e 100644 --- a/yarn-project/foundation/src/log/pino-logger.ts +++ b/yarn-project/foundation/src/log/pino-logger.ts @@ -1,7 +1,6 @@ import { createColors } from 'colorette'; import isNode from 'detect-node'; import { pino, symbols } from 'pino'; -import pretty from 'pino-pretty'; import { type Writable } from 'stream'; import { inspect } from 'util'; @@ -68,7 +67,7 @@ const [logLevel, logFilters] = parseEnv(process.env.LOG_LEVEL, defaultLogLevel); // Transport options for pretty logging to stderr via pino-pretty. const useColor = true; const { bold, reset } = createColors({ useColor }); -const pinoPrettyOpts = { +export const pinoPrettyOpts = { destination: 2, sync: true, colorize: useColor, @@ -78,6 +77,7 @@ const pinoPrettyOpts = { customColors: 'fatal:bgRed,error:red,warn:yellow,info:green,verbose:magenta,debug:blue,trace:gray', minimumLevel: 'trace' as const, }; + const prettyTransport: pino.TransportSingleOptions = { target: 'pino-pretty', options: pinoPrettyOpts, @@ -113,11 +113,13 @@ const otelTransport: pino.TransportSingleOptions = { function makeLogger() { if (!isNode) { - // We are on the browser + // We are on the browser. return pino({ ...pinoOpts, browser: { asObject: false } }); } else if (process.env.JEST_WORKER_ID) { - // We are on jest, so we need sync logging. We stream to stderr with pretty. - return pino(pinoOpts, pretty(pinoPrettyOpts)); + // We are on jest, so we need sync logging and stream to stderr. + // We expect jest/setup.mjs to kick in later and replace set up a pretty logger, + // but if for some reason it doesn't, at least we're covered with a default logger. + return pino(pinoOpts, pino.destination(2)); } else { // Regular nodejs with transports on worker thread, using pino-pretty for console logging if LOG_JSON // is not set, and an optional OTLP transport if the OTLP endpoint is provided. @@ -142,6 +144,14 @@ logger.verbose( : `Browser console logger initialized with level ${logLevel}`, ); +/** + * Overwrites the logging stream with a different destination. + * Used by jest/setup.mjs to set up a pretty logger. + */ +export function overwriteLoggingStream(stream: Writable): void { + (logger as any)[symbols.streamSym] = stream; +} + /** * Registers an additional destination to the pino logger. * Use only when working with destinations, not worker transports. diff --git a/yarn-project/ivc-integration/package.json b/yarn-project/ivc-integration/package.json index cadb0ac977d4..7b2b97b9bb0a 100644 --- a/yarn-project/ivc-integration/package.json +++ b/yarn-project/ivc-integration/package.json @@ -59,7 +59,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/bb.js": "../../ts", diff --git a/yarn-project/key-store/package.json b/yarn-project/key-store/package.json index 8b13546037a3..8409775334b0 100644 --- a/yarn-project/key-store/package.json +++ b/yarn-project/key-store/package.json @@ -54,7 +54,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", diff --git a/yarn-project/kv-store/package.json b/yarn-project/kv-store/package.json index 1c795da1a6c5..b4c97eb44743 100644 --- a/yarn-project/kv-store/package.json +++ b/yarn-project/kv-store/package.json @@ -91,6 +91,9 @@ ], "testRegex": "./src/.*\\.test\\.(js|mjs|ts)$", "rootDir": "./src", - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] } } diff --git a/yarn-project/merkle-tree/package.json b/yarn-project/merkle-tree/package.json index 47e394fda288..096700c8bbfe 100644 --- a/yarn-project/merkle-tree/package.json +++ b/yarn-project/merkle-tree/package.json @@ -55,7 +55,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", diff --git a/yarn-project/noir-contracts.js/package.json b/yarn-project/noir-contracts.js/package.json index 71bad5162915..c54eb0a59654 100644 --- a/yarn-project/noir-contracts.js/package.json +++ b/yarn-project/noir-contracts.js/package.json @@ -54,7 +54,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/aztec.js": "workspace:^", diff --git a/yarn-project/noir-protocol-circuits-types/package.json b/yarn-project/noir-protocol-circuits-types/package.json index 3f2549b9005c..4168c9fc5ff7 100644 --- a/yarn-project/noir-protocol-circuits-types/package.json +++ b/yarn-project/noir-protocol-circuits-types/package.json @@ -58,7 +58,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuits.js": "workspace:^", diff --git a/yarn-project/p2p-bootstrap/package.json b/yarn-project/p2p-bootstrap/package.json index 6da59d796656..f1f6942279db 100644 --- a/yarn-project/p2p-bootstrap/package.json +++ b/yarn-project/p2p-bootstrap/package.json @@ -82,7 +82,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "engines": { "node": ">=18" diff --git a/yarn-project/p2p/package.json b/yarn-project/p2p/package.json index 79ed2a4b8677..69c44f335624 100644 --- a/yarn-project/p2p/package.json +++ b/yarn-project/p2p/package.json @@ -60,7 +60,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", diff --git a/yarn-project/package.common.json b/yarn-project/package.common.json index 8fd6e79b1fdc..5d7e61c0e2af 100644 --- a/yarn-project/package.common.json +++ b/yarn-project/package.common.json @@ -55,6 +55,9 @@ ], "testTimeout": 30000, "testRegex": "./src/.*\\.test\\.(js|mjs|ts)$", - "rootDir": "./src" + "rootDir": "./src", + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] } } \ No newline at end of file diff --git a/yarn-project/proof-verifier/package.json b/yarn-project/proof-verifier/package.json index 537995488650..9dcd38472e96 100644 --- a/yarn-project/proof-verifier/package.json +++ b/yarn-project/proof-verifier/package.json @@ -75,6 +75,9 @@ ], "testRegex": "./src/.*\\.test\\.(js|mjs|ts)$", "rootDir": "./src", - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] } } diff --git a/yarn-project/protocol-contracts/package.json b/yarn-project/protocol-contracts/package.json index ad6618938f84..d12d967b95e5 100644 --- a/yarn-project/protocol-contracts/package.json +++ b/yarn-project/protocol-contracts/package.json @@ -65,7 +65,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuits.js": "workspace:^", diff --git a/yarn-project/prover-client/package.json b/yarn-project/prover-client/package.json index 86a92c7c5190..4bf5b869215a 100644 --- a/yarn-project/prover-client/package.json +++ b/yarn-project/prover-client/package.json @@ -64,7 +64,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/bb-prover": "workspace:^", diff --git a/yarn-project/prover-node/package.json b/yarn-project/prover-node/package.json index d4ee18d170bb..27bb2c8bd60e 100644 --- a/yarn-project/prover-node/package.json +++ b/yarn-project/prover-node/package.json @@ -50,7 +50,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/archiver": "workspace:^", diff --git a/yarn-project/pxe/package.json b/yarn-project/pxe/package.json index 1338e301b2ec..5320283c7d58 100644 --- a/yarn-project/pxe/package.json +++ b/yarn-project/pxe/package.json @@ -65,7 +65,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/bb-prover": "workspace:^", diff --git a/yarn-project/scripts/package.json b/yarn-project/scripts/package.json index 0b62716012f7..a0cb7920eff7 100644 --- a/yarn-project/scripts/package.json +++ b/yarn-project/scripts/package.json @@ -84,7 +84,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "engines": { "node": ">=18" diff --git a/yarn-project/sequencer-client/package.json b/yarn-project/sequencer-client/package.json index e5c56b8809d1..334377750069 100644 --- a/yarn-project/sequencer-client/package.json +++ b/yarn-project/sequencer-client/package.json @@ -110,6 +110,9 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] } } diff --git a/yarn-project/simulator/package.json b/yarn-project/simulator/package.json index 53d15188c544..8c3668fd8fa9 100644 --- a/yarn-project/simulator/package.json +++ b/yarn-project/simulator/package.json @@ -60,7 +60,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", diff --git a/yarn-project/telemetry-client/package.json b/yarn-project/telemetry-client/package.json index 2df1379cd7cb..15ef986d543b 100644 --- a/yarn-project/telemetry-client/package.json +++ b/yarn-project/telemetry-client/package.json @@ -84,6 +84,9 @@ ], "testRegex": "./src/.*\\.test\\.(js|mjs|ts)$", "rootDir": "./src", - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] } } diff --git a/yarn-project/txe/package.json b/yarn-project/txe/package.json index ff673d798d83..79132b5d3695 100644 --- a/yarn-project/txe/package.json +++ b/yarn-project/txe/package.json @@ -58,7 +58,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/accounts": "workspace:^", diff --git a/yarn-project/types/package.json b/yarn-project/types/package.json index 688b9ea661b1..9c0adbd1c672 100644 --- a/yarn-project/types/package.json +++ b/yarn-project/types/package.json @@ -60,7 +60,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/ethereum": "workspace:^", diff --git a/yarn-project/validator-client/package.json b/yarn-project/validator-client/package.json index 127f4a25e572..637cbb5a31e3 100644 --- a/yarn-project/validator-client/package.json +++ b/yarn-project/validator-client/package.json @@ -57,7 +57,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", diff --git a/yarn-project/world-state/package.json b/yarn-project/world-state/package.json index b684e5055e21..4da25512fd15 100644 --- a/yarn-project/world-state/package.json +++ b/yarn-project/world-state/package.json @@ -60,7 +60,10 @@ } ] ], - "testTimeout": 30000 + "testTimeout": 30000, + "setupFiles": [ + "../../foundation/src/jest/setup.mjs" + ] }, "dependencies": { "@aztec/circuit-types": "workspace:^", From 92981f512fb922925af726cfca7d6371ddc16a17 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Tue, 10 Dec 2024 12:21:43 -0300 Subject: [PATCH 2/2] Lint --- yarn-project/foundation/src/jest/setup.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yarn-project/foundation/src/jest/setup.mjs b/yarn-project/foundation/src/jest/setup.mjs index 14184256ca4a..04519061c54e 100644 --- a/yarn-project/foundation/src/jest/setup.mjs +++ b/yarn-project/foundation/src/jest/setup.mjs @@ -1,8 +1,9 @@ import { overwriteLoggingStream, pinoPrettyOpts } from '@aztec/foundation/log'; + import pretty from 'pino-pretty'; // Overwrite logging stream with pino-pretty. We define this as a separate // file so we don't mess up with dependencies in non-testing environments, // since pino-pretty messes up with browser bundles. // See also https://www.npmjs.com/package/pino-pretty?activeTab=readme#user-content-usage-with-jest -overwriteLoggingStream(pretty(pinoPrettyOpts)); \ No newline at end of file +overwriteLoggingStream(pretty(pinoPrettyOpts));