diff --git a/modules/ports/sync.ts b/modules/ports/sync.ts index a024ff23..8599f806 100644 --- a/modules/ports/sync.ts +++ b/modules/ports/sync.ts @@ -75,7 +75,7 @@ async function movebleTmpPath(targetDir: string, targetTmpDirName = "tmp") { if ((await targetPath.stat())?.dev != (await defaultTmpPath.stat())?.dev) { return targetPath.join(targetTmpDirName); } - return defaultTmpPath.join("ghjkTmp"); + return await defaultTmpPath.join("ghjkTmp").ensureDir(); } export async function sync( diff --git a/tests/ports.ts b/tests/ports.ts index 13cb27d7..8ee3d711 100644 --- a/tests/ports.ts +++ b/tests/ports.ts @@ -19,20 +19,12 @@ import whiz from "../ports/whiz.ts"; import cpython from "../ports/cpy_bs.ts"; import pipi from "../ports/pipi.ts"; -type CustomE2eTestCase = Omit & { ePoint: string }; +type CustomE2eTestCase = Omit & { + ePoint: string; + ignore?: boolean; +}; // order tests by download size to make failed runs less expensive const cases: CustomE2eTestCase[] = [ - ...(Deno.build.os == "linux" - ? [ - // 8 megs - { - name: "mold", - installConf: mold(), - ePoint: `mold -V`, - }, - ] - : []), - // 3 megs { name: "protoc", @@ -63,6 +55,13 @@ const cases: CustomE2eTestCase[] = [ installConf: cargo_binstall(), ePoint: `cargo-binstall -V`, }, + // 8 megs + { + name: "mold", + installConf: mold(), + ePoint: `mold -V`, + ignore: Deno.build.os != "linux", + }, // 16 megs { name: "wasmedge", @@ -148,18 +147,21 @@ function testMany( ) { for (const testCase of cases) { Deno.test( - `${testGroup} - ${testCase.name}`, - () => - testFn({ - ...testCase, - ePoints: ["bash -c", "fish -c", "zsh -c"].map((sh) => ({ - cmd: `env ${sh} '${testCase.ePoint}'`, - })), - envs: { - ...defaultEnvs, - ...testCase.envs, - }, - }), + { + name: `${testGroup} - ${testCase.name}`, + ignore: testCase.ignore, + fn: () => + testFn({ + ...testCase, + ePoints: ["bash -c", "fish -c", "zsh -c"].map((sh) => ({ + cmd: `env ${sh} '${testCase.ePoint}'`, + })), + envs: { + ...defaultEnvs, + ...testCase.envs, + }, + }), + }, ); } } diff --git a/tests/utils.ts b/tests/utils.ts index 0734e456..8c4f517c 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -114,18 +114,8 @@ export async function localE2eTest(testCase: E2eTestCase) { prefix: "ghjk_le2e_", }), ); - const ghjkDir = await tmpDir.join("ghjk").ensureDir(); - await install({ - ...defaultInstallArgs, - skipExecInstall: false, - ghjkExecInstallDir: ghjkDir.toString(), - // share the system's deno cache - ghjkDenoCacheDir: Deno.env.get("DENO_DIR"), - ghjkDir: ghjkDir.toString(), - // don't modify system shell configs - shellsToHook: [], - }); + const installConfArray = Array.isArray(installConf) ? installConf : [installConf]; @@ -172,14 +162,17 @@ export const secureConfig = JSON.parse(secConfStr); ZDOTDIR: ghjkDir.toString(), GHJK_DIR: ghjkDir.toString(), }; - { - const confHome = await ghjkDir.join(".config").ensureDir(); - const fishConfDir = await confHome.join("fish").ensureDir(); - await fishConfDir.join("config.fish").createSymlinkTo( - ghjkDir.join("env.fish").toString(), - ); - env["XDG_CONFIG_HOME"] = confHome.toString(); - } + // install ghjk + await install({ + ...defaultInstallArgs, + skipExecInstall: false, + ghjkExecInstallDir: ghjkDir.toString(), + // share the system's deno cache + ghjkDenoCacheDir: Deno.env.get("DENO_DIR"), + ghjkDir: ghjkDir.toString(), + // don't modify system shell configs + shellsToHook: [], + }); await $`${ghjkDir.join("ghjk").toString()} print config` .cwd(tmpDir.toString()) .env(env); @@ -194,6 +187,14 @@ export const secureConfig = JSON.parse(secConfStr); entry.path.toString().slice(ghjkDirLen), ])); */ + { + const confHome = await ghjkDir.join(".config").ensureDir(); + const fishConfDir = await confHome.join("fish").ensureDir(); + await fishConfDir.join("config.fish").createSymlinkTo( + ghjkDir.join("env.fish").toString(), + ); + env["XDG_CONFIG_HOME"] = confHome.toString(); + } for (const ePoint of ePoints) { let cmd = $.raw`${ePoint.cmd}` .cwd(tmpDir.toString())