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

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

Merged
merged 12 commits into from
Feb 12, 2024
Merged

Conversation

aduh95
Copy link
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
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
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.

tests/setupTests.js Outdated Show resolved Hide resolved
@aduh95 aduh95 requested a review from merceyz February 12, 2024 18:13
tests/setupTests.js Show resolved Hide resolved
tests/setupTests.js Outdated Show resolved Hide resolved
tests/setupTests.js Show resolved Hide resolved
@aduh95 aduh95 enabled auto-merge (squash) February 12, 2024 22:29
@aduh95 aduh95 merged commit 12f1c31 into main Feb 12, 2024
10 checks passed
@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.

None yet

2 participants