惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
腾讯CDC
博客园 - 聂微东
爱范儿
爱范儿
罗磊的独立博客
P
Proofpoint News Feed
博客园 - Franky
博客园 - 三生石上(FineUI控件)
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
Blog — PlanetScale
Blog — PlanetScale
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
美团技术团队
MongoDB | Blog
MongoDB | Blog
WordPress大学
WordPress大学
A
About on SuperTechFans
I
InfoQ
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(onboard): skip Homebrew prompt on unsupported platfor...
vincentkoc · 2026-06-16 · via Recent Commits to openclaw:main
11

// Onboard skills tests cover skill setup prompts, package manager config, and skip behavior.

2-

import { afterEach, describe, expect, it, vi } from "vitest";

2+

import { beforeEach, describe, expect, it, vi } from "vitest";

33

import type { OpenClawConfig } from "../config/config.js";

44

import type { RuntimeEnv } from "../runtime.js";

55

import type { WizardPrompter } from "../wizard/prompts.js";

@@ -143,16 +143,30 @@ const runtime: RuntimeEnv = {

143143

}) as RuntimeEnv["exit"],

144144

};

145145146+

const supportsHomebrewPrompt = process.platform === "darwin" || process.platform === "linux";

147+148+

async function withPlatform<T>(platform: NodeJS.Platform, fn: () => Promise<T>): Promise<T> {

149+

const originalPlatformDescriptor = Object.getOwnPropertyDescriptor(process, "platform")!;

150+

Object.defineProperty(process, "platform", {

151+

configurable: true,

152+

value: platform,

153+

});

154+

try {

155+

return await fn();

156+

} finally {

157+

Object.defineProperty(process, "platform", originalPlatformDescriptor);

158+

}

159+

}

160+146161

describe("setupSkills", () => {

147-

afterEach(() => {

162+

beforeEach(() => {

163+

vi.clearAllMocks();

148164

mocks.isContainerEnvironment.mockReset();

149165

mocks.resolveBrewExecutable.mockReset();

150166

});

151167152168

it("hides brew-only installs in Linux containers when brew is missing", async () => {

153-

const originalPlatformDescriptor = Object.getOwnPropertyDescriptor(process, "platform")!;

154-

Object.defineProperty(process, "platform", { value: "linux", configurable: true });

155-

try {

169+

await withPlatform("linux", async () => {

156170

mockMissingBrewStatus([

157171

createBundledSkill({

158172

name: "video-frames",

@@ -173,15 +187,11 @@ describe("setupSkills", () => {

173187

expect(

174188

notes.find((n) => n.message.includes("No missing skill dependencies to install")),

175189

).toBeUndefined();

176-

} finally {

177-

Object.defineProperty(process, "platform", originalPlatformDescriptor);

178-

}

190+

});

179191

});

180192181193

it("keeps brew-only installs visible when Linuxbrew is resolved off PATH", async () => {

182-

const originalPlatformDescriptor = Object.getOwnPropertyDescriptor(process, "platform")!;

183-

Object.defineProperty(process, "platform", { value: "linux", configurable: true });

184-

try {

194+

await withPlatform("linux", async () => {

185195

mockMissingBrewStatus([

186196

createBundledSkill({

187197

name: "video-frames",

@@ -202,13 +212,11 @@ describe("setupSkills", () => {

202212

);

203213

expect(notes.find((n) => n.title === "Container skill installs")).toBeUndefined();

204214

expect(notes.find((n) => n.title === "Homebrew recommended")).toBeUndefined();

205-

} finally {

206-

Object.defineProperty(process, "platform", originalPlatformDescriptor);

207-

}

215+

});

208216

});

209217210218

it("does not recommend Homebrew when user skips installing brew-backed deps", async () => {

211-

if (process.platform === "win32") {

219+

if (!supportsHomebrewPrompt) {

212220

return;

213221

}

214222

@@ -247,7 +255,7 @@ describe("setupSkills", () => {

247255

});

248256249257

it("recommends Homebrew when user selects a brew-backed install and brew is missing", async () => {

250-

if (process.platform === "win32") {

258+

if (!supportsHomebrewPrompt) {

251259

return;

252260

}

253261

@@ -279,4 +287,24 @@ describe("setupSkills", () => {

279287

expect(emptyStateNote?.message).toContain("openclaw skills list --verbose");

280288

expect(emptyStateNote?.message).toContain("openclaw skills check");

281289

});

290+291+

it("does not recommend Homebrew on FreeBSD", async () => {

292+

await withPlatform("freebsd", async () => {

293+

mockMissingBrewStatus([

294+

createBundledSkill({

295+

name: "video-frames",

296+

description: "ffmpeg",

297+

bins: ["ffmpeg"],

298+

installLabel: "Install ffmpeg (brew)",

299+

}),

300+

]);

301+302+

const { prompter, notes } = createPrompter({ multiselect: ["video-frames"] });

303+

await setupSkills({} as OpenClawConfig, "/tmp/ws", runtime, prompter);

304+305+

const brewNote = notes.find((n) => n.title === "Homebrew recommended");

306+

expect(brewNote).toBeUndefined();

307+

expect(mocks.detectBinary).not.toHaveBeenCalledWith("brew");

308+

});

309+

});

282310

});