Skip to content

Commit eab6bf6

Browse files
test(shell): cover mixed PATH keys in inherited environments
1 parent eaaeffa commit eab6bf6

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

‎packages/shared/src/shell.test.ts‎

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -879,25 +879,27 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
879879
}),
880880
);
881881

882-
it.effect("probes node with a single PATH key when the inherited env spells it Path", () =>
883-
Effect.gen(function* () {
884-
const probedEnvironments: Array<NodeJS.ProcessEnv | undefined> = [];
885-
886-
yield* withWindowsEnvironmentMocks(
887-
resolveWindowsEnvironment({ Path: "C:\\Windows\\System32" }),
888-
() => ({ PATH: "C:\\Shell\\Bin" }),
889-
(_command, options) =>
890-
Effect.sync(() => {
891-
probedEnvironments.push(options?.env);
892-
return true;
893-
}),
894-
);
882+
it.effect(
883+
"probes node with one PATH key when inherited environment records have mixed casing",
884+
() =>
885+
Effect.gen(function* () {
886+
const probedEnvironments: Array<NodeJS.ProcessEnv | undefined> = [];
895887

896-
const pathEntries = Object.entries(probedEnvironments[0] ?? {}).filter(
897-
([key]) => key.toUpperCase() === "PATH",
898-
);
899-
expect(pathEntries).toEqual([["PATH", "C:\\Shell\\Bin;C:\\Windows\\System32"]]);
900-
}),
888+
yield* withWindowsEnvironmentMocks(
889+
resolveWindowsEnvironment({ Path: "C:\\Stale", PATH: "C:\\Windows\\System32" }),
890+
() => ({ PATH: "C:\\Shell\\Bin" }),
891+
(_command, options) =>
892+
Effect.sync(() => {
893+
probedEnvironments.push(options?.env);
894+
return true;
895+
}),
896+
);
897+
898+
const pathEntries = Object.entries(probedEnvironments[0] ?? {}).filter(
899+
([key]) => key.toUpperCase() === "PATH",
900+
);
901+
expect(pathEntries).toEqual([["PATH", "C:\\Shell\\Bin;C:\\Windows\\System32"]]);
902+
}),
901903
);
902904

903905
it.effect("loads the PowerShell profile when baseline env cannot resolve node", () =>

0 commit comments

Comments
 (0)