Skip to content

Commit 858ea4d

Browse files
committed
fixup! test: use TEST_TMPDIR as fallback for E2E temporary directory
1 parent f88256d commit 858ea4d

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎tests/e2e/tests/misc/create-angular.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { equal } from 'node:assert';
2-
import { join, resolve } from 'node:path';
2+
import { join } from 'node:path';
33
import { expectFileToExist, readFile, rimraf } from '../../utils/fs';
44
import { getActivePackageManager } from '../../utils/packages';
55
import { silentBun, silentNpm, silentPnpm, silentYarn } from '../../utils/process';
6+
import { mktempd } from '../../utils/utils';
67

78
export default async function () {
89
const currentDirectory = process.cwd();
9-
const newDirectory = resolve('../');
10+
const newDirectory = await mktempd('create-angular-test-');
1011
const projectName = 'test-project-create';
1112

1213
try {

‎tests/e2e/utils/test_process.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const testFunction: () => Promise<void> | void =
1818
console.error('Test Process error', e);
1919
process.exitCode = -1;
2020
} finally {
21-
killAllProcesses().finally(() => process.exit());
21+
await killAllProcesses().catch(() => {});
22+
process.exit();
2223
}
2324
})();

‎tests/e2e/utils/utils.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function expectToFail(fn: () => Promise<any>, errorMessage?: string): Pro
2121
export async function mktempd(prefix: string, tempRoot?: string): Promise<string> {
2222
return realpath(
2323
await mkdtemp(
24-
path.join(tempRoot ?? process.env.E2E_TEMP ?? process.env.TEST_TMPDIR ?? tmpdir(), prefix),
24+
path.join(tempRoot || process.env.E2E_TEMP || process.env.TEST_TMPDIR || tmpdir(), prefix),
2525
),
2626
);
2727
}

0 commit comments

Comments
 (0)