From d78945eff946cb8f60e8b7ee92062eadd223ca9e Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Tue, 9 Dec 2025 17:52:18 -0500 Subject: [PATCH] fix test errors by adding to repo test as well Signed-off-by: aramissennyeydd --- .../cli/src/modules/build/lib/runner/runBackend.test.ts | 5 +---- packages/cli/src/modules/test/commands/repo/test.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/modules/build/lib/runner/runBackend.test.ts b/packages/cli/src/modules/build/lib/runner/runBackend.test.ts index 11018b0783..fbffec92d3 100644 --- a/packages/cli/src/modules/build/lib/runner/runBackend.test.ts +++ b/packages/cli/src/modules/build/lib/runner/runBackend.test.ts @@ -60,12 +60,9 @@ describe('runBackend', () => { // Save original environment originalEnv = { ...process.env }; + process.env = {}; originalPlatform = process.platform; - // Clear environment variables that we're testing - delete process.env.NODE_ENV; - delete process.env.NODE_OPTIONS; - // Mock process.stdin.on to prevent actual stdin reading jest.spyOn(process.stdin, 'on').mockReturnValue(process.stdin); diff --git a/packages/cli/src/modules/test/commands/repo/test.ts b/packages/cli/src/modules/test/commands/repo/test.ts index fd18ba09fe..40e6666dcf 100644 --- a/packages/cli/src/modules/test/commands/repo/test.ts +++ b/packages/cli/src/modules/test/commands/repo/test.ts @@ -289,6 +289,14 @@ export async function command(opts: OptionValues, cmd: Command): Promise { process.env.TZ = 'UTC'; } + // Unless the user explicitly toggles node-snapshot, default to provide --no-node-snapshot to reduce number of steps to run scaffolder + // on Node LTS. + if (!process.env.NODE_OPTIONS?.includes('--node-snapshot')) { + process.env.NODE_OPTIONS = `${ + process.env.NODE_OPTIONS ? `${process.env.NODE_OPTIONS} ` : '' + }--no-node-snapshot`; + } + // This ensures that the process doesn't exit too early before stdout is flushed if (args.includes('--jest-help')) { removeOptionArg(args, '--jest-help');