Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/core/__tests__/packaging.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ test("should apply the packed Three.js patch in a clean consumer and remain idem
await run("tar", ["-xzf", join(archiveDirectory, archive), "-C", archiveDirectory]);

const packed = join(archiveDirectory, "package");
// Only this release's patch ships. A project on r187 starts from stock three, so there is no
// predecessor patch state to migrate and no upgrade patch to carry.
await expect(
readFile(join(packed, "patches", "[email protected]"), "utf8"),
).rejects.toThrow(/ENOENT/u);
// 0.3.10 and 0.3.11 already patched r187, so a project upgrading from them is in a predecessor
// patch state: the upgrade patch ships beside this release's patch (release run 42307165770).
expect(
await readFile(join(packed, "patches", "[email protected]"), "utf8"),
).toBe(await readFile(join(coreRoot, "patches", "[email protected]"), "utf8"));
expect(await readFile(join(packed, "patches", "[email protected]"), "utf8")).toBe(
await readFile(join(coreRoot, "patches", "[email protected]"), "utf8"),
);
Expand Down
18 changes: 18 additions & 0 deletions packages/core/__tests__/three-patch-upgrade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,21 @@ ${after
await expect(applyThreePatch({ packageRoot, threeRoot })).rejects.toThrow("cyclic known upgrade");
expect(await readFile(target, "utf8")).toBe(STOCK.join("\n"));
});

// Release run 42307165770: hunks changed after 0.3.11 with no upgrade entry, so a 0.3.11 game failed
// `pnpm install` at TN_THREE_PATCH_PARTIAL. Each upgrade entry must land on the bytes the current patch
// installs; a patch edit without a regenerated upgrade file fails here instead of in the release proof.
it("lands every known upgrade on the blob the current patch installs", async () => {
const patches = join(import.meta.dirname, "../patches");
const upgrade = await readFile(join(patches, "[email protected]"), "utf8");
const targets = [
...upgrade.matchAll(/^diff --git a\/(\S+) b\/\S+\nindex [0-9a-f]{40}\.\.([0-9a-f]{40})/gmu),
];
expect(targets.length).toBeGreaterThan(0);
const three = join(import.meta.dirname, "../node_modules/three");
for (const [, file, blob] of targets) {
const bytes = await readFile(join(three, file as string));
const hash = createHash("sha1").update(`blob ${bytes.length}\0`).update(bytes).digest("hex");
expect({ file, hash }).toEqual({ file, hash: blob });
}
});
Loading
Loading