fix(cli): fail clearly on unsupported Node versions (#2388)

This commit is contained in:
Miguel Ángel
2026-07-16 12:03:13 -04:00
committed by GitHub
parent 584be6d64a
commit e846cd6004
6 changed files with 42 additions and 1 deletions
+19
View File
@@ -0,0 +1,19 @@
import { describe, expect, it } from "vitest";
import { runtimeVersionError } from "./runtimeVersion.js";
describe("runtimeVersionError", () => {
it("rejects Node 20 before the bundled CLI is imported", () => {
expect(runtimeVersionError("20.11.1")).toBe(
"HyperFrames requires Node.js >= 22 (current: 20.11.1). Switch Node versions and retry.",
);
});
it("accepts supported Node releases", () => {
expect(runtimeVersionError("22.0.0")).toBeNull();
expect(runtimeVersionError("24.14.0")).toBeNull();
});
it("rejects malformed versions safely", () => {
expect(runtimeVersionError("unknown")).toContain("requires Node.js >= 22");
});
});