[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:
Mitchell Nally
2023-01-07 10:55:54 +11:00
committed by GitHub
parent 976e082c44
commit 1e13a6ca48
2 changed files with 30 additions and 1 deletions

View File

@@ -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', () => {
// note: this also tests the last object doesn't overwrite `PATH` with
// `undefined`