mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:40:44 +00:00
QA: accept nodejs as Node runtime
This commit is contained in:
@@ -12,6 +12,19 @@ describe("resolveQaNodeExecPath", () => {
|
||||
).resolves.toBe("/opt/homebrew/bin/node");
|
||||
});
|
||||
|
||||
it("reuses nodejs as a valid current Node executable", async () => {
|
||||
await expect(
|
||||
resolveQaNodeExecPath({
|
||||
execPath: "/usr/bin/nodejs",
|
||||
platform: "linux",
|
||||
versions: { ...process.versions, bun: undefined },
|
||||
execFileImpl: async () => {
|
||||
throw new Error("should not search PATH");
|
||||
},
|
||||
}),
|
||||
).resolves.toBe("/usr/bin/nodejs");
|
||||
});
|
||||
|
||||
it("resolves node from PATH when the parent runtime is bun", async () => {
|
||||
await expect(
|
||||
resolveQaNodeExecPath({
|
||||
|
||||
@@ -16,7 +16,12 @@ const execFileAsync = promisify(execFile) as unknown as ExecFileAsync;
|
||||
function isNodeExecPath(execPath: string, platform: NodeJS.Platform): boolean {
|
||||
const pathModule = platform === "win32" ? path.win32 : path.posix;
|
||||
const basename = pathModule.basename(execPath).toLowerCase();
|
||||
return basename === "node" || basename === "node.exe";
|
||||
return (
|
||||
basename === "node" ||
|
||||
basename === "node.exe" ||
|
||||
basename === "nodejs" ||
|
||||
basename === "nodejs.exe"
|
||||
);
|
||||
}
|
||||
|
||||
export async function resolveQaNodeExecPath(params?: {
|
||||
|
||||
Reference in New Issue
Block a user