open-design/tools/pack/tests/package-source-hash.test.ts
PerishFire 6efac8887e
Improve Windows beta packaging and installer flow (#768)
* Optimize Windows packaged web output

* Fix packaged contracts runtime build

* Optimize Windows packaged size pruning

* Prune Windows root Next payload

* Remove Windows bundled Node runtime

* Prune Windows standalone duplicate Next

* Add tools-pack cache foundation

* Cache Windows packaged build layers

* Cache Windows workspace builds

* Cache Electron-ready Windows app

* Split Windows tools-pack module

* Cache Windows dir build outputs

* Split Windows pack build modules

* Document Windows NSIS smoke namespace limits

* Move Windows NSIS smoke note to agents guide

* Optimize Windows beta packaging

* Bump packaged beta base version

* Improve Windows installer namespace UX

* Improve Windows tools-pack cache keys

* Stabilize Windows beta cache version keys

* Cache Windows workspace build outputs

* Optimize windows release beta cache layers

* Cache windows release dependencies

* Trim windows release cache before save

* Refresh windows tools-pack cache key

* Improve windows installer preflight prompts

* Fallback NSIS installer strings to English

* Fix Windows installer cleanup and preflight

* Improve Windows NSIS state logging

* Fix system NSIS Persian language alias

* Use long-path removal for Windows uninstall

* Fix mac tools-pack tests on Windows

* Address Windows packaging review feedback

* Fix Windows installer cache namespace isolation

* Include web output mode in Windows tarball cache key

* Use unique Windows release cache save keys
2026-05-07 16:44:15 +08:00

27 lines
1.2 KiB
TypeScript

import { mkdir, mkdtemp, writeFile, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { hashPackageSourcePath } from "../src/package-source-hash.js";
describe("hashPackageSourcePath", () => {
it("includes package versions in the source hash", async () => {
const root = await mkdtemp(join(tmpdir(), "open-design-package-source-hash-"));
const packageRoot = join(root, "apps", "packaged");
try {
await mkdir(join(packageRoot, "src"), { recursive: true });
await writeFile(join(packageRoot, "src", "index.ts"), "export const value = 1;\n", "utf8");
await writeFile(join(packageRoot, "package.json"), `${JSON.stringify({ name: "@open-design/packaged", version: "1.0.0" }, null, 2)}\n`, "utf8");
const firstHash = await hashPackageSourcePath(packageRoot);
await writeFile(join(packageRoot, "package.json"), `${JSON.stringify({ name: "@open-design/packaged", version: "1.0.1" }, null, 2)}\n`, "utf8");
const secondHash = await hashPackageSourcePath(packageRoot);
expect(secondHash).not.toBe(firstHash);
} finally {
await rm(root, { force: true, recursive: true });
}
});
});