Skip to content

Commit 945fcc1

Browse files
committed
test: assert runtime guard diagnostics
1 parent d932d89 commit 945fcc1

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

src/infra/runtime-guard.test.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,17 @@ describe("runtime-guard", () => {
8686
pathEnv: "/usr/bin",
8787
};
8888
expect(() => assertSupportedRuntime(runtime, details)).toThrow("exit");
89-
expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("requires Node"));
90-
expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("Detected: node 20.0.0"));
89+
expect(runtime.error).toHaveBeenCalledOnce();
90+
expect(runtime.error).toHaveBeenCalledWith(
91+
[
92+
"openclaw requires Node >=22.16.0.",
93+
"Detected: node 20.0.0 (exec: /usr/bin/node).",
94+
"PATH searched: /usr/bin",
95+
"Install Node: https://nodejs.org/en/download",
96+
"Upgrade Node and re-run openclaw.",
97+
].join("\n"),
98+
);
99+
expect(runtime.exit).toHaveBeenCalledWith(1);
91100
});
92101

93102
it("returns silently when runtime meets requirements", () => {
@@ -122,8 +131,16 @@ describe("runtime-guard", () => {
122131
};
123132

124133
expect(() => assertSupportedRuntime(runtime, details)).toThrow("exit");
134+
expect(runtime.error).toHaveBeenCalledOnce();
125135
expect(runtime.error).toHaveBeenCalledWith(
126-
expect.stringContaining("Detected: unknown runtime (exec: unknown)."),
136+
[
137+
"openclaw requires Node >=22.16.0.",
138+
"Detected: unknown runtime (exec: unknown).",
139+
"PATH searched: (not set)",
140+
"Install Node: https://nodejs.org/en/download",
141+
"Upgrade Node and re-run openclaw.",
142+
].join("\n"),
127143
);
144+
expect(runtime.exit).toHaveBeenCalledWith(1);
128145
});
129146
});

0 commit comments

Comments
 (0)