Skip to content

chore(tests): use separate envs for each tests#371

Merged
aduh95 merged 12 commits intomainfrom
separate-envs-in-tests
Feb 12, 2024
Merged

chore(tests): use separate envs for each tests#371
aduh95 merged 12 commits intomainfrom
separate-envs-in-tests

Conversation

@aduh95
Copy link
Copy Markdown
Contributor

@aduh95 aduh95 commented Jan 30, 2024

It seems better to use throw away objects rather modifying the parent env, as it makes it less likely that we forget to remove a key that could end up affecting other tests.

@aduh95
Copy link
Copy Markdown
Contributor Author

aduh95 commented Feb 11, 2024

@nodejs/corepack any opinions on this? I'd rather not spend time on fixing the conflicts if I'm the only one in support for this change.

@merceyz
Copy link
Copy Markdown
Member

merceyz commented Feb 11, 2024

The goal makes sense but I would rather use a beforeEach and afterEeach hook in a setupFile to do it.

Clone process.env in the beforeEach hook and restore it again in afterEach.

Comment thread tests/setupTests.js Outdated
@aduh95 aduh95 requested a review from merceyz February 12, 2024 18:13
Comment thread tests/setupTests.js
Comment thread tests/setupTests.js Outdated
Comment thread tests/setupTests.js
@aduh95 aduh95 enabled auto-merge (squash) February 12, 2024 22:29
@aduh95 aduh95 merged commit 12f1c31 into main Feb 12, 2024
@aduh95 aduh95 deleted the separate-envs-in-tests branch February 12, 2024 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants