mirror of https://github.com/nodejs/corepack.git
20 lines
527 B
TypeScript
20 lines
527 B
TypeScript
import process from 'process';
|
|
import {beforeEach, afterAll} from 'vitest';
|
|
|
|
const OLD_ENV = process.env;
|
|
// To ensure we test the default behavior, we must remove these env vars
|
|
// in case the local machine already set these values.
|
|
const processEnv = Object.fromEntries(
|
|
Object.entries(process.env).filter(
|
|
([key]) => key !== `FORCE_COLOR` && key !== `DEBUG` && !key.startsWith(`COREPACK_`),
|
|
),
|
|
);
|
|
|
|
beforeEach(() => {
|
|
process.env = {...processEnv};
|
|
});
|
|
|
|
afterAll(() => {
|
|
process.env = OLD_ENV;
|
|
});
|