nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.52k stars 165 forks source link

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

Closed aduh95 closed 7 months ago

aduh95 commented 8 months ago

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 commented 7 months ago

@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 commented 7 months ago

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.