From f032b3ac79e9e43918bc478e5f38a3d4f3e6a366 Mon Sep 17 00:00:00 2001 From: Pietro Marchini Date: Mon, 18 Aug 2025 12:58:03 +0200 Subject: [PATCH 1/2] test: lazy-load internalTTy --- test/parallel/test-runner-output.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-runner-output.mjs b/test/parallel/test-runner-output.mjs index ccfca45e502fd5..6a46bc8a475f39 100644 --- a/test/parallel/test-runner-output.mjs +++ b/test/parallel/test-runner-output.mjs @@ -6,13 +6,18 @@ import { describe, it } from 'node:test'; import { hostname } from 'node:os'; import { chdir, cwd } from 'node:process'; import { fileURLToPath } from 'node:url'; -import internalTTy from 'internal/tty'; + +let internalTTy; +async function lazyInternalTTy() { + internalTTy ??= (await import('internal/tty')).default; + return internalTTy; +} const skipForceColors = process.config.variables.icu_gyp_path !== 'tools/icu/icu-generic.gyp' || process.config.variables.node_shared_openssl; -const canColorize = internalTTy.getColorDepth() > 2; +const canColorize = (await lazyInternalTTy()).getColorDepth() > 2; const skipCoverageColors = !canColorize; function replaceTestDuration(str) { From b8c646644924f6e3f6c59cefa611ff0043b9f3af Mon Sep 17 00:00:00 2001 From: Pietro Marchini Date: Wed, 20 Aug 2025 14:34:18 +0200 Subject: [PATCH 2/2] fixup! test: lazy-load internalTTy --- test/parallel/test-runner-output.mjs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-runner-output.mjs b/test/parallel/test-runner-output.mjs index 6a46bc8a475f39..7169c28e293dbe 100644 --- a/test/parallel/test-runner-output.mjs +++ b/test/parallel/test-runner-output.mjs @@ -7,17 +7,12 @@ import { hostname } from 'node:os'; import { chdir, cwd } from 'node:process'; import { fileURLToPath } from 'node:url'; -let internalTTy; -async function lazyInternalTTy() { - internalTTy ??= (await import('internal/tty')).default; - return internalTTy; -} - const skipForceColors = process.config.variables.icu_gyp_path !== 'tools/icu/icu-generic.gyp' || process.config.variables.node_shared_openssl; -const canColorize = (await lazyInternalTTy()).getColorDepth() > 2; +// We're using dynamic import here to not break `NODE_REGENERATE_SNAPSHOTS`. +const canColorize = (await import('internal/tty')).default.getColorDepth() > 2; const skipCoverageColors = !canColorize; function replaceTestDuration(str) {