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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
量子位
S
SegmentFault 最新的问题
博客园 - 聂微东
博客园 - 【当耐特】
J
Java Code Geeks
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
V
V2EX
人人都是产品经理
人人都是产品经理
博客园 - Franky
罗磊的独立博客
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research

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
test(diffs): use native viewer asset file URLs · openclaw...
vincentkoc · 2026-05-05 · via Recent Commits to openclaw:main

@@ -1,4 +1,6 @@

11

import fs from "node:fs";

2+

import { join } from "node:path";

3+

import { fileURLToPath, pathToFileURL } from "node:url";

24

import AjvPkg from "ajv";

35

import type { JsonSchemaObject } from "openclaw/plugin-sdk/config-schema";

46

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

@@ -399,44 +401,59 @@ describe("diffs viewer URL helpers", () => {

399401400402

describe("viewer assets", () => {

401403

it("prefers the built plugin asset layout when present", async () => {

404+

const repoRoot = join(process.cwd(), "tmp", "diffs-viewer-assets-test-repo");

405+

const builtRuntimePath = join(

406+

repoRoot,

407+

"dist",

408+

"extensions",

409+

"diffs",

410+

"assets",

411+

"viewer-runtime.js",

412+

);

402413

const stat = vi.fn(async (path: string) => {

403-

if (path === "/repo/dist/extensions/diffs/assets/viewer-runtime.js") {

414+

if (path === builtRuntimePath) {

404415

return { mtimeMs: 1 };

405416

}

406417

const error = Object.assign(new Error(`missing: ${path}`), { code: "ENOENT" });

407418

throw error;

408419

});

409420410-

await expect(

411-

resolveViewerRuntimeFileUrl({

412-

baseUrl: "file:///repo/dist/extensions/diffs/index.js",

413-

stat,

414-

}),

415-

).resolves.toMatchObject({

416-

pathname: "/repo/dist/extensions/diffs/assets/viewer-runtime.js",

421+

const runtimeUrl = await resolveViewerRuntimeFileUrl({

422+

baseUrl: pathToFileURL(join(repoRoot, "dist", "extensions", "diffs", "index.js")),

423+

stat,

417424

});

425+426+

expect(fileURLToPath(runtimeUrl)).toBe(builtRuntimePath);

418427

expect(stat).toHaveBeenCalledTimes(1);

419428

});

420429421430

it("falls back to the source asset layout when the built artifact is absent", async () => {

431+

const repoRoot = join(process.cwd(), "tmp", "diffs-viewer-assets-test-repo");

432+

const sourceCandidatePath = join(

433+

repoRoot,

434+

"extensions",

435+

"diffs",

436+

"src",

437+

"assets",

438+

"viewer-runtime.js",

439+

);

440+

const sourceRuntimePath = join(repoRoot, "extensions", "diffs", "assets", "viewer-runtime.js");

422441

const stat = vi.fn(async (path: string) => {

423-

if (path === "/repo/extensions/diffs/assets/viewer-runtime.js") {

442+

if (path === sourceRuntimePath) {

424443

return { mtimeMs: 1 };

425444

}

426445

const error = Object.assign(new Error(`missing: ${path}`), { code: "ENOENT" });

427446

throw error;

428447

});

429448430-

await expect(

431-

resolveViewerRuntimeFileUrl({

432-

baseUrl: "file:///repo/extensions/diffs/src/viewer-assets.js",

433-

stat,

434-

}),

435-

).resolves.toMatchObject({

436-

pathname: "/repo/extensions/diffs/assets/viewer-runtime.js",

449+

const runtimeUrl = await resolveViewerRuntimeFileUrl({

450+

baseUrl: pathToFileURL(join(repoRoot, "extensions", "diffs", "src", "viewer-assets.js")),

451+

stat,

437452

});

438-

expect(stat).toHaveBeenNthCalledWith(1, "/repo/extensions/diffs/src/assets/viewer-runtime.js");

439-

expect(stat).toHaveBeenNthCalledWith(2, "/repo/extensions/diffs/assets/viewer-runtime.js");

453+454+

expect(fileURLToPath(runtimeUrl)).toBe(sourceRuntimePath);

455+

expect(stat).toHaveBeenNthCalledWith(1, sourceCandidatePath);

456+

expect(stat).toHaveBeenNthCalledWith(2, sourceRuntimePath);

440457

});

441458442459

it("serves a stable loader that points at the current runtime bundle", async () => {