mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 12:57:47 +00:00
[build-utils] Add fix for windows git bash to check path is set (#9163)
Co-authored-by: Chris Barber <chris.barber@vercel.com> Co-authored-by: Steven <steven@ceriously.com>
This commit is contained in:
@@ -25,7 +25,11 @@ export function cloneEnv(...envs: (Env | undefined)[]): Env {
|
|||||||
// however we lose this proxied value when we destructure and
|
// however we lose this proxied value when we destructure and
|
||||||
// thus we must explicitly copy it, but we must also remove the
|
// thus we must explicitly copy it, but we must also remove the
|
||||||
// `Path` property since we can't have both a `PATH` and `Path`
|
// `Path` property since we can't have both a `PATH` and `Path`
|
||||||
|
|
||||||
|
if (obj.Path !== undefined) {
|
||||||
obj.PATH = obj.Path;
|
obj.PATH = obj.Path;
|
||||||
|
}
|
||||||
|
|
||||||
delete obj.Path;
|
delete obj.Path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
25
packages/build-utils/test/unit.clone-env.test.ts
vendored
25
packages/build-utils/test/unit.clone-env.test.ts
vendored
@@ -36,6 +36,31 @@ it('should clone env with PATH', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not overwrite PATH when path is undefined', () => {
|
||||||
|
expect(
|
||||||
|
cloneEnv(
|
||||||
|
{
|
||||||
|
PATH: 'baz',
|
||||||
|
},
|
||||||
|
new Proxy(
|
||||||
|
{
|
||||||
|
Path: undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
get(target: typeof process.env, prop: string) {
|
||||||
|
if (prop === 'PATH') {
|
||||||
|
return target.PATH ?? target.Path;
|
||||||
|
}
|
||||||
|
return target[prop];
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toEqual({
|
||||||
|
PATH: 'baz',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should clone and merge multiple env objects', () => {
|
it('should clone and merge multiple env objects', () => {
|
||||||
// note: this also tests the last object doesn't overwrite `PATH` with
|
// note: this also tests the last object doesn't overwrite `PATH` with
|
||||||
// `undefined`
|
// `undefined`
|
||||||
|
|||||||
Reference in New Issue
Block a user