From cc33de0a5af01fb7e64f615395250b1c57462f34 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 4 Sep 2023 11:09:55 -0400 Subject: [PATCH] chore: update test to handle case when env var is set (#304) * chore: update test to handle case when env var is set - Fixes https://github.com/nodejs/corepack/issues/303 * revert * delete env vars in setupTests.js * remove newline --- tests/setupTests.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/setupTests.js b/tests/setupTests.js index 991947a58..fdf59307c 100644 --- a/tests/setupTests.js +++ b/tests/setupTests.js @@ -8,6 +8,18 @@ switch (process.env.NOCK_ENV || ``) { case `record`: case `replay`: beforeEach(() => { + // To ensure we test the default behavior, we must remove these env vars + // in case the local machine already set these values. + delete process.env.COREPACK_DEFAULT_TO_LATEST; + delete process.env.COREPACK_ENABLE_NETWORK; + delete process.env.COREPACK_ENABLE_PROJECT_SPEC; + delete process.env.COREPACK_ENABLE_STRICT; + delete process.env.COREPACK_HOME; + delete process.env.COREPACK_NPM_REGISTRY; + delete process.env.COREPACK_NPM_TOKEN; + delete process.env.COREPACK_NPM_USERNAME; + delete process.env.FORCE_COLOR; + process.env.RUN_CLI_ID = 0; process.env.NOCK_FILE_NAME = crypto .createHash(`md5`)