chore: rename temp dir for clarity
This commit is contained in:
parent
5bde7a062d
commit
13449b3524
3 changed files with 5 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
/dist
|
/dist
|
||||||
/.test-dist
|
/.temp
|
||||||
public/
|
public/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import * as path from "path";
|
||||||
|
|
||||||
const ROOT_DIR = path.resolve(__dirname, "..");
|
const ROOT_DIR = path.resolve(__dirname, "..");
|
||||||
const DIST_DIR = path.join(ROOT_DIR, "dist");
|
const DIST_DIR = path.join(ROOT_DIR, "dist");
|
||||||
const TEST_DIR = path.join(ROOT_DIR, ".test-dist");
|
const TEST_DIR = path.join(ROOT_DIR, ".temp");
|
||||||
|
|
||||||
const rmdirRecursive = (dirPath: string): void => {
|
const rmdirRecursive = (dirPath: string): void => {
|
||||||
if (!fs.existsSync(dirPath)) {
|
if (!fs.existsSync(dirPath)) {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export const wait = async (timeMs: number): Promise<void> => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const TEST_DIST_PATH = path.resolve(__dirname, "..", "..", ".test-dist");
|
const TEMP_PATH = path.resolve(__dirname, "..", "..", ".temp");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform an operation within a unique temporary directory created within a
|
* Perform an operation within a unique temporary directory created within a
|
||||||
|
|
@ -38,8 +38,8 @@ const TEST_DIST_PATH = path.resolve(__dirname, "..", "..", ".test-dist");
|
||||||
export const withTempDir = async (
|
export const withTempDir = async (
|
||||||
op: (tempDirPath: string) => Promise<void> | void
|
op: (tempDirPath: string) => Promise<void> | void
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
await fs.mkdir(TEST_DIST_PATH, { recursive: true });
|
await fs.mkdir(TEMP_PATH, { recursive: true });
|
||||||
const tempDirPath = await fs.mkdtemp(`${TEST_DIST_PATH}/`);
|
const tempDirPath = await fs.mkdtemp(`${TEMP_PATH}/`);
|
||||||
try {
|
try {
|
||||||
await op(tempDirPath);
|
await op(tempDirPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue