Workaround PATH casing issues on Windows
This commit is contained in:
parent
4792297702
commit
c15604920a
3 changed files with 18 additions and 1 deletions
|
|
@ -63,6 +63,16 @@ export function setupTests(test: TestFn<any>) {
|
|||
t.context.stderrWrite = processStderrWrite;
|
||||
process.stderr.write = wrapOutput(t.context) as any;
|
||||
|
||||
// Workaround an issue in tests where the case insensitivity of the `$PATH`
|
||||
// environment variable on Windows isn't preserved, i.e. `process.env.PATH`
|
||||
// is not the same as `process.env.Path`.
|
||||
const pathKeys = Object.keys(process.env).filter(
|
||||
(k) => k.toLowerCase() === "path"
|
||||
);
|
||||
if (pathKeys.length > 0) {
|
||||
process.env.PATH = process.env[pathKeys[0]];
|
||||
}
|
||||
|
||||
// Many tests modify environment variables. Take a copy now so that
|
||||
// we reset them after the test to keep tests independent of each other.
|
||||
// process.env only has strings fields, so a shallow copy is fine.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue