Skip to content

Commit

Permalink
chore: update test to handle case when env var is set (#304)
Browse files Browse the repository at this point in the history
* chore: update test to handle case when env var is set

- Fixes #303

* revert

* delete env vars in setupTests.js

* remove newline
  • Loading branch information
styfle authored Sep 4, 2023
1 parent 2bf76c9 commit cc33de0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down

0 comments on commit cc33de0

Please sign in to comment.