chore(tests): remove temporary directories in test teardown (#666)

This commit is contained in:
Antoine du Hamel 2025-02-28 12:21:15 +01:00 committed by GitHub
parent b0608d1a60
commit bb16184b7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -5,9 +5,15 @@ import {describe, beforeEach, it, expect} from 'vitest';
import {runCli} from './_runCli';
beforeEach(async () => {
const home = await xfs.mktempPromise();
// `process.env` is reset after each tests in setupTests.js.
process.env.COREPACK_HOME = npath.fromPortablePath(await xfs.mktempPromise());
process.env.COREPACK_HOME = npath.fromPortablePath(home);
process.env.COREPACK_DEFAULT_TO_LATEST = `0`;
return async () => {
await xfs.removePromise(home, {recursive: true});
};
});
describe(`UpCommand`, () => {

View File

@ -5,9 +5,15 @@ import {describe, beforeEach, it, expect} from 'vitest';
import {runCli} from './_runCli';
beforeEach(async () => {
const home = await xfs.mktempPromise();
// `process.env` is reset after each tests in setupTests.js.
process.env.COREPACK_HOME = npath.fromPortablePath(await xfs.mktempPromise());
process.env.COREPACK_HOME = npath.fromPortablePath(home);
process.env.COREPACK_DEFAULT_TO_LATEST = `0`;
return async () => {
await xfs.removePromise(home, {recursive: true});
};
});
describe(`UseCommand`, () => {