mirror of
https://github.com/nexu-io/open-design.git
synced 2026-09-20 06:15:06 +08:00
4b48f94b7c
* refactor(ci): align tools-pack sources with scope boundaries * refactor(tools-pack): unify test source imports * fix(tools-pack): resolve workspace root from package Generated-By: looper 0.11.2 (runner=fixer, agent=codex) * test(tools-pack): exercise bundled CLI directly --------- Co-authored-by: Looper <looper@noreply.github.com>
28 lines
1.2 KiB
TypeScript
28 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 "@/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 });
|
|
}
|
|
});
|
|
});
|