mirror of https://github.com/nodejs/corepack.git
test: clear all `COREPACK_*` environment variables (#392)
Co-authored-by: Maël Nison <nison.mael@gmail.com>
This commit is contained in:
parent
00506b2a15
commit
451dcf8229
|
|
@ -6,21 +6,13 @@ const process = require(`process`);
|
||||||
jest.retryTimes(2, {logErrorsBeforeRetry: true});
|
jest.retryTimes(2, {logErrorsBeforeRetry: true});
|
||||||
|
|
||||||
const OLD_ENV = process.env;
|
const OLD_ENV = process.env;
|
||||||
const {
|
// To ensure we test the default behavior, we must remove these env vars
|
||||||
// To ensure we test the default behavior, we must remove these env vars
|
// in case the local machine already set these values.
|
||||||
// in case the local machine already set these values.
|
const processEnv = Object.fromEntries(
|
||||||
COREPACK_DEFAULT_TO_LATEST,
|
Object.entries(process.env).filter(
|
||||||
COREPACK_ENABLE_NETWORK,
|
([key]) => key !== `FORCE_COLOR` && !key.startsWith(`COREPACK_`),
|
||||||
COREPACK_ENABLE_PROJECT_SPEC,
|
),
|
||||||
COREPACK_ENABLE_STRICT,
|
);
|
||||||
COREPACK_HOME,
|
|
||||||
COREPACK_NPM_REGISTRY,
|
|
||||||
COREPACK_NPM_TOKEN,
|
|
||||||
COREPACK_NPM_USERNAME,
|
|
||||||
FORCE_COLOR,
|
|
||||||
// We save the rest to put it into `process.env` for tests.
|
|
||||||
...processEnv
|
|
||||||
} = process.env;
|
|
||||||
|
|
||||||
switch (process.env.NOCK_ENV || ``) {
|
switch (process.env.NOCK_ENV || ``) {
|
||||||
case `record`:
|
case `record`:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue