Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: clear all COREPACK_* environment variables #392

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions tests/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@ const process = require(`process`);
jest.retryTimes(2, {logErrorsBeforeRetry: true});

const OLD_ENV = process.env;
const {
// To ensure we test the default behavior, we must remove these env vars
// in case the local machine already set these values.
COREPACK_DEFAULT_TO_LATEST,
COREPACK_ENABLE_NETWORK,
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;
// 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.startsWith(`COREPACK_`),
),
);

switch (process.env.NOCK_ENV || ``) {
case `record`:
Expand Down