Skip to content

Commit ec3a565

Browse files
committed
fix(tests): use exact spawn env pattern from working commit 39ee946
Revert to the exact spawn call pattern that worked in commit 39ee946. That commit successfully passed Windows tests while spreading all three env sources unconditionally: - process.env - constants.processEnv (which is process.env) - spawnEnv (undefined when no custom env) This suggests the spreading itself is not the issue.
1 parent f1169c0 commit ec3a565

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

packages/cli/test/utils.mts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,22 +266,19 @@ export async function spawnSocketCli(
266266
const commandArgs = isJsFile ? [entryPath, ...args] : args
267267

268268
try {
269-
// Build options conditionally to avoid passing env when not needed.
270-
// This preserves Windows process.env proxy behavior.
271-
// Spreading process.env breaks case-insensitive env var access on Windows.
272-
const spawnOptions = {
269+
const output = await spawn(command, commandArgs, {
273270
cwd,
271+
env: {
272+
...process.env,
273+
...constants.processEnv,
274+
...spawnEnv,
275+
},
274276
...restOptions,
275277
// Close stdin to prevent tests from hanging
276278
// when commands wait for input. Must be after restOptions
277279
// to ensure it's not overridden.
278280
stdio: restOptions.stdio ?? ['ignore', 'pipe', 'pipe'],
279-
// Only add env if custom environment variables are provided.
280-
// This avoids breaking Windows process.env proxy behavior.
281-
...(spawnEnv ? { env: { ...constants.processEnv, ...spawnEnv } } : {}),
282-
}
283-
284-
const output = await spawn(command, commandArgs, spawnOptions)
281+
})
285282
return {
286283
status: true,
287284
code: 0,

0 commit comments

Comments
 (0)