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

推荐订阅源

L
LangChain Blog
有赞技术团队
有赞技术团队
博客园_首页
IT之家
IT之家
爱范儿
爱范儿
量子位
小众软件
小众软件
Jina AI
Jina AI
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
The Cloudflare Blog
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
雷峰网
雷峰网
V
Visual Studio Blog
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题

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: reuse platform spy helper in infra tests · openclaw...
vincentkoc · 2026-05-17 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,5 +1,6 @@

11

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

22

import { captureFullEnv } from "../test-utils/env.js";

3+

import { mockProcessPlatform } from "../test-utils/vitest-spies.js";

34

import { SUPERVISOR_HINT_ENV_VARS } from "./supervisor-markers.js";

45
56

const spawnMock = vi.hoisted(() => vi.fn());

@@ -30,16 +31,9 @@ import {

3031

const originalArgv = [...process.argv];

3132

const originalExecArgv = [...process.execArgv];

3233

const envSnapshot = captureFullEnv();

33-

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

3434
35-

function setPlatform(platform: string) {

36-

if (!originalPlatformDescriptor) {

37-

return;

38-

}

39-

Object.defineProperty(process, "platform", {

40-

...originalPlatformDescriptor,

41-

value: platform,

42-

});

35+

function setPlatform(platform: NodeJS.Platform) {

36+

mockProcessPlatform(platform);

4337

}

4438
4539

afterEach(() => {

@@ -50,9 +44,7 @@ afterEach(() => {

5044

triggerOpenClawRestartMock.mockClear();

5145

isContainerEnvironmentMock.mockReset();

5246

isContainerEnvironmentMock.mockReturnValue(false);

53-

if (originalPlatformDescriptor) {

54-

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

55-

}

47+

vi.restoreAllMocks();

5648

});

5749
5850

function clearSupervisorHints() {

Original file line numberDiff line numberDiff line change

@@ -1,5 +1,6 @@

11

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

22

import { captureFullEnv } from "../test-utils/env.js";

3+

import { mockProcessPlatform } from "../test-utils/vitest-spies.js";

34
45

const spawnSyncMock = vi.hoisted(() => vi.fn());

56

const resolveLsofCommandSyncMock = vi.hoisted(() => vi.fn());

@@ -29,7 +30,6 @@ let triggerOpenClawRestart: typeof import("./restart.js").triggerOpenClawRestart

2930
3031

let currentTimeMs = 0;

3132

const envSnapshot = captureFullEnv();

32-

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

3333
3434

beforeAll(async () => {

3535

({ __testing, cleanStaleGatewayProcessesSync, findGatewayPidsOnPortSync } =

@@ -55,20 +55,11 @@ afterEach(() => {

5555

envSnapshot.restore();

5656

__testing.setSleepSyncOverride(null);

5757

__testing.setDateNowOverride(null);

58-

if (originalPlatformDescriptor) {

59-

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

60-

}

6158

vi.restoreAllMocks();

6259

});

6360
6461

function setPlatform(platform: NodeJS.Platform): void {

65-

if (!originalPlatformDescriptor) {

66-

return;

67-

}

68-

Object.defineProperty(process, "platform", {

69-

...originalPlatformDescriptor,

70-

value: platform,

71-

});

62+

mockProcessPlatform(platform);

7263

}

7364
7465

function requireFirstSpawnSyncCall(): [unknown, unknown, unknown] {

Original file line numberDiff line numberDiff line change

@@ -1,5 +1,6 @@

11

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

22

import { captureEnv } from "../test-utils/env.js";

3+

import { mockProcessPlatform } from "../test-utils/vitest-spies.js";

34
45

const readFileSyncMock = vi.hoisted(() => vi.fn());

56

const readFileMock = vi.hoisted(() => vi.fn());

@@ -30,13 +31,8 @@ let isWSL2Sync: typeof import("./wsl.js").isWSL2Sync;

3031

let isWSL: typeof import("./wsl.js").isWSL;

3132

let resetWSLStateForTests: typeof import("./wsl.js").resetWSLStateForTests;

3233
33-

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

34-
3534

function setPlatform(platform: NodeJS.Platform): void {

36-

Object.defineProperty(process, "platform", {

37-

value: platform,

38-

configurable: true,

39-

});

35+

mockProcessPlatform(platform);

4036

}

4137
4238

describe("wsl detection", () => {

@@ -60,9 +56,7 @@ describe("wsl detection", () => {

6056

afterEach(() => {

6157

envSnapshot.restore();

6258

resetWSLStateForTests();

63-

if (originalPlatformDescriptor) {

64-

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

65-

}

59+

vi.restoreAllMocks();

6660

});

6761
6862

it.each([