mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
* fix(packaged): recover stale launcher and sidecar state * fix(packaged): write launcher cleanup from installer sync * perf(tools-pack): reuse windows payload caches * perf(tools-pack): avoid slow windows 7z filters * fix(tools-pack): bound windows payload archive hangs * test(packaged): stabilize sidecar tests on windows * fix(tools-pack): harden launcher runtime sync helper * fix(tools-pack): invalidate nsis cache for installer helpers * fix(tools-pack): hash nsis helper source in bundled cli * fix(packaged): restart when existing desktop has stale sidecars * chore(release): bump beta base to 0.11.1 * fix(e2e): seed windows smoke onboarding in runtime data * ci(release): let beta runs use default queueing * ci(release): restore beta concurrency guard * ci(release): enable beta mac x64 by default * ci(release): disable beta mac x64 by default * fix(updater): clean deprecated launcher payloads on startup * fix(e2e): align stable dry-run fixture version Generated-By: looper 0.9.10+codex.autoclean (runner=fixer, agent=codex) --------- Co-authored-by: Looper <looper@noreply.github.com>
76 lines
2.9 KiB
TypeScript
76 lines
2.9 KiB
TypeScript
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import type { ToolPackConfig } from "../src/config.js";
|
|
import { createWinRemovalPlan } from "../src/win/paths.js";
|
|
|
|
function createConfig(root: string, removeCache: boolean): ToolPackConfig {
|
|
return {
|
|
containerized: false,
|
|
electronBuilderCliPath: "electron-builder",
|
|
electronDistPath: "electron-dist",
|
|
electronVersion: "41.3.0",
|
|
macCompression: "normal",
|
|
namespace: "cache-test",
|
|
platform: "win",
|
|
portable: false,
|
|
removeCache,
|
|
removeData: false,
|
|
removeLogs: false,
|
|
removeProductUserData: false,
|
|
removeSidecars: false,
|
|
requireVelaCli: false,
|
|
roots: {
|
|
cacheRoot: join(root, ".cache"),
|
|
output: {
|
|
appBuilderRoot: join(root, "out", "builder"),
|
|
namespaceRoot: join(root, "out", "win", "namespaces", "cache-test"),
|
|
platformRoot: join(root, "out", "win"),
|
|
root: join(root, "out"),
|
|
},
|
|
runtime: {
|
|
namespaceBaseRoot: join(root, "runtime", "win", "namespaces"),
|
|
namespaceRoot: join(root, "runtime", "win", "namespaces", "cache-test"),
|
|
},
|
|
toolPackRoot: join(root, ".tmp", "tools-pack"),
|
|
},
|
|
signed: false,
|
|
silent: true,
|
|
to: "dir",
|
|
webOutputMode: "server",
|
|
workspaceRoot: root,
|
|
};
|
|
}
|
|
|
|
describe("createWinRemovalPlan", () => {
|
|
it("models download/cache directories separately from user data", async () => {
|
|
const root = await mkdtemp(join(tmpdir(), "od-win-removal-plan-"));
|
|
try {
|
|
const config = createConfig(root, true);
|
|
const runtimeRoot = config.roots.runtime.namespaceRoot;
|
|
await mkdir(join(runtimeRoot, "cache"), { recursive: true });
|
|
await mkdir(join(runtimeRoot, "updates", "downloads"), { recursive: true });
|
|
await mkdir(join(runtimeRoot, "updates", "releases"), { recursive: true });
|
|
await mkdir(join(runtimeRoot, "updates", "staging"), { recursive: true });
|
|
await mkdir(join(runtimeRoot, "data"), { recursive: true });
|
|
|
|
const plan = await createWinRemovalPlan(config);
|
|
|
|
expect(plan.filter((target) => target.scope === "cache")).toEqual([
|
|
expect.objectContaining({ exists: true, path: join(runtimeRoot, "cache"), willRemove: true }),
|
|
expect.objectContaining({ exists: true, path: join(runtimeRoot, "updates", "downloads"), willRemove: true }),
|
|
expect.objectContaining({ exists: true, path: join(runtimeRoot, "updates", "releases"), willRemove: true }),
|
|
expect.objectContaining({ exists: true, path: join(runtimeRoot, "updates", "staging"), willRemove: true }),
|
|
]);
|
|
expect(plan.find((target) => target.scope === "data")).toEqual(
|
|
expect.objectContaining({ exists: true, path: join(runtimeRoot, "data"), willRemove: false }),
|
|
);
|
|
} finally {
|
|
await rm(root, { force: true, recursive: true });
|
|
}
|
|
});
|
|
});
|