Files
reverse-engineering-anything/src/javascript/recovery/WakaruVersion.test.ts
T
Pionxzhandmorluto ded59689ce fix(javascript): accept the Wakaru 1.x release line and verify 1.14.0 (#1540)
* fix(javascript): accept the Wakaru 1.x release line and verify 1.14.0

Exact --version equality rejected every Wakaru build except 1.13.0, and
strict report schemas rejected any added field, so each upstream release
broke recovery until REA re-pinned. Wakaru now documents that --version,
--json and provenance.json change only by addition within a major version.

Admit ^1.13.0 with the verified/compatible split used for Binwalk and
Unblob, report the observed version instead of the pinned constant, and
add a limitation for unverified releases. Parse reports with loose
objects and keep the reported module status as a string; path, identity,
range and file-set checks stay exact.

Move the audited pin, submodule, CI binary and verifier to 1.14.0, and
document where to get the binary from the refusal message.

* fix(javascript): project known Wakaru warning fields

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-10-10 23:02:15 +08:00

40 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { admitWakaruVersion } from "./WakaruVersion.js";
import { WAKARU_RELEASE } from "./WakaruRelease.js";
describe("Wakaru release range", () => {
it("accepts the verified banner without an extra limitation", () => {
expect(admitWakaruVersion(`wakaru ${WAKARU_RELEASE.version}`)).toEqual({
status: "verified",
version: WAKARU_RELEASE.version,
});
});
it.each([
["wakaru 1.13.0", "1.13.0"],
["wakaru 1.15.2", "1.15.2"],
])("accepts %s as compatible", (banner, version) => {
const admitted = admitWakaruVersion(banner);
expect(admitted).toMatchObject({ status: "compatible", version });
if (admitted.status !== "compatible")
throw new Error("expected a compatible release");
expect(admitted.limitation).toContain(version);
expect(admitted.limitation).toContain(WAKARU_RELEASE.version);
});
it.each([
["wakaru 1.12.0", "wakaru 1.12.0"],
["wakaru 2.0.0", "wakaru 2.0.0"],
["wakaru 1.15.0-rc.1", "wakaru 1.15.0-rc.1"],
["wakaru v1.14.0", "wakaru v1.14.0"],
["1.14.0", "1.14.0"],
["", "missing"],
])("rejects banner %j", (banner, detail) => {
const admitted = admitWakaruVersion(banner);
if (admitted.status !== "unsupported")
throw new Error("expected a rejected banner");
expect(admitted.message).toContain(detail);
expect(admitted.message).toContain("^1.13.0");
});
});