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

推荐订阅源

J
Java Code Geeks
美团技术团队
Recent Announcements
Recent Announcements
B
Blog
GbyAI
GbyAI
雷峰网
雷峰网
博客园_首页
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
V
V2EX
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
L
LangChain Blog
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
A
About on SuperTechFans
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
Hugging Face - Blog
Hugging Face - Blog
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏

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(installer): fail failed Windows git builds · openclaw...
vincentkoc · 2026-05-23 · via Recent Commits to openclaw:main

@@ -6,7 +6,12 @@ import { createScriptTestHarness } from "./test-helpers";

6677

const SCRIPT_PATH = "scripts/install.ps1";

88

const ENTRYPOINT_RE =

9-

/\r?\n\$mainResults = @\(Main\)\r?\n\$installSucceeded = \$mainResults\.Count -gt 0 -and \$mainResults\[-1\] -eq \$true\r?\nComplete-Install -Succeeded:\$installSucceeded\s*$/m;

9+

/\r?\n\$mainResults = @\(Main\)\r?\n\$installSucceeded = Test-BooleanSuccessResult -Results \$mainResults\r?\nComplete-Install -Succeeded:\$installSucceeded\s*$/m;

10+

const ENTRYPOINT_LINES = [

11+

"$mainResults = @(Main)",

12+

"$installSucceeded = Test-BooleanSuccessResult -Results $mainResults",

13+

"Complete-Install -Succeeded:$installSucceeded",

14+

];

10151116

function extractFunctionBody(source: string, name: string): string {

1217

const match = source.match(

@@ -50,9 +55,7 @@ function createFailingNodeFixture(source: string): string {

5055

"function Check-Node { return $false }",

5156

"function Install-Node { return $false }",

5257

"",

53-

"$mainResults = @(Main)",

54-

"$installSucceeded = $mainResults.Count -gt 0 -and $mainResults[-1] -eq $true",

55-

"Complete-Install -Succeeded:$installSucceeded",

58+

...ENTRYPOINT_LINES,

5659

"",

5760

].join("\n");

5861

}

@@ -77,9 +80,12 @@ describe("install.ps1 failure handling", () => {

77807881

it("keeps failure termination in the top-level completion handler", () => {

7982

const completeInstallBody = extractFunctionBody(source, "Complete-Install");

83+

const booleanSuccessBody = extractFunctionBody(source, "Test-BooleanSuccessResult");

8084

expect(completeInstallBody).toMatch(/\$PSCommandPath/);

8185

expect(completeInstallBody).toMatch(/\bexit \$script:InstallExitCode\b/);

8286

expect(completeInstallBody).toMatch(/\bthrow "OpenClaw installation failed with exit code/);

87+

expect(booleanSuccessBody).toContain("$Results.Count -gt 0");

88+

expect(source).toContain("$installSucceeded = Test-BooleanSuccessResult -Results $mainResults");

8389

});

84908591

it("runs npm install through the resolved command with quiet CI defaults", () => {

@@ -227,6 +233,7 @@ describe("install.ps1 failure handling", () => {

227233

const pnpmVersionMatchBody = extractFunctionBody(source, "Test-PnpmCommandMatchesVersion");

228234

const ensurePnpmBody = extractFunctionBody(source, "Ensure-Pnpm");

229235

const gitInstallBody = extractFunctionBody(source, "Install-OpenClawFromGit");

236+

const mainBody = extractFunctionBody(source, "Main");

230237231238

expect(pnpmVersionBody).toContain("package.json");

232239

expect(pnpmVersionBody).toContain("$packageJson.packageManager -match '^pnpm@(?<version>[^+]+)'");

@@ -247,9 +254,31 @@ describe("install.ps1 failure handling", () => {

247254

expect(gitInstallBody.indexOf("git -C $RepoDir pull --rebase")).toBeLessThan(

248255

gitInstallBody.indexOf("Ensure-Pnpm -RepoDir $RepoDir"),

249256

);

257+

expect(mainBody).toContain("$gitInstallResults = @(Install-OpenClawFromGit");

258+

expect(mainBody).toContain(

259+

"Test-BooleanSuccessResult -Results $gitInstallResults",

260+

);

261+

expect(mainBody).toContain("$npmInstallResults = @(Install-OpenClaw)");

262+

expect(mainBody).toContain(

263+

"Test-BooleanSuccessResult -Results $npmInstallResults",

264+

);

250265

expect(gitInstallBody).toContain("Push-Location -LiteralPath $RepoDir");

251266

expect(gitInstallBody).toContain("& $pnpmCommand install");

267+

expect(gitInstallBody).toContain(

268+

'Write-Host "[!] pnpm install failed for the Git checkout"',

269+

);

270+

expect(gitInstallBody).toContain("& $pnpmCommand build");

271+

expect(gitInstallBody).toContain(

272+

'Write-Host "[!] pnpm build failed for the Git checkout"',

273+

);

274+

expect(gitInstallBody).toContain('$entryPath = Join-Path $RepoDir "dist\\\\entry.js"');

275+

expect(gitInstallBody).toContain("Test-Path $entryPath");

276+

expect(gitInstallBody).toContain(

277+

'Write-Host "[!] OpenClaw build did not produce $entryPath"',

278+

);

279+

expect(gitInstallBody).toContain('node ""$entryPath"" %*');

252280

expect(gitInstallBody).not.toContain("& $pnpmCommand -C $RepoDir install");

281+

expect(gitInstallBody).not.toContain('node ""$RepoDir\\\\dist\\\\entry.js"" %*');

253282

});

254283255284

it("cleans legacy git submodules only from the selected git checkout", () => {

@@ -309,6 +338,42 @@ describe("install.ps1 failure handling", () => {

309338

expect(result.stdout).toContain("alive-after-install");

310339

});

311340341+

runIfPowerShell("treats noisy Git install false as failure", () => {

342+

const tempDir = harness.createTempDir("openclaw-install-ps1-");

343+

const scriptPath = join(tempDir, "install.ps1");

344+

const scriptWithoutEntryPoint = source.replace(ENTRYPOINT_RE, "");

345+

writeFileSync(

346+

scriptPath,

347+

[

348+

scriptWithoutEntryPoint,

349+

"",

350+

"function Write-Banner { }",

351+

"function Ensure-ExecutionPolicy { return $true }",

352+

"function Check-Node { return $true }",

353+

"function Check-ExistingOpenClaw { return $false }",

354+

"function Get-NpmCommandPath { return $null }",

355+

"function Install-OpenClawFromGit {",

356+

" Write-Output 'pnpm stdout before failure'",

357+

" return $false",

358+

"}",

359+

"function Ensure-OpenClawOnPath { throw 'should not continue after failed git install' }",

360+

"$InstallMethod = 'git'",

361+

"$GitDir = 'C:\\\\openclaw-test'",

362+

"$NoOnboard = $true",

363+

"$result = Main",

364+

'if ($result -ne $false) { throw "Main returned $result" }',

365+

'if ($script:InstallExitCode -ne 1) { throw "InstallExitCode=$script:InstallExitCode" }',

366+

"",

367+

].join("\n"),

368+

);

369+

chmodSync(scriptPath, 0o755);

370+371+

const result = runPowerShell(["-NoLogo", "-NoProfile", "-Command", `. ${toPowerShellSingleQuotedLiteral(scriptPath)}`]);

372+373+

expect(result.status).toBe(0);

374+

expect(result.stderr).toBe("");

375+

});

376+312377

runIfPowerShell("keeps npm chatter out of Main's success return value", () => {

313378

const tempDir = harness.createTempDir("openclaw-install-ps1-");

314379

const scriptPath = join(tempDir, "install.ps1");

@@ -371,9 +436,7 @@ describe("install.ps1 failure handling", () => {

371436

"function Refresh-GatewayServiceIfLoaded { }",

372437

"function Invoke-OpenClawCommand { return 'OpenClaw test-version' }",

373438

"$NoOnboard = $true",

374-

"$mainResults = @(Main)",

375-

"$installSucceeded = $mainResults.Count -gt 0 -and $mainResults[-1] -eq $true",

376-

"Complete-Install -Succeeded:$installSucceeded",

439+

...ENTRYPOINT_LINES,

377440

"",

378441

].join("\n"),

379442

);