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

推荐订阅源

博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
Vercel News
Vercel News
Recent Announcements
Recent Announcements
B
Blog RSS Feed
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
MongoDB | Blog
MongoDB | Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
D
Docker
Jina AI
Jina AI
IT之家
IT之家
人人都是产品经理
人人都是产品经理
L
LangChain Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
博客园 - 叶小钗
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - 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
test: tighten scoped config setup assertions · openclaw/o...
shakkernerd · 2026-05-09 · via Recent Commits to openclaw:main

@@ -85,6 +85,14 @@ function matchingExcludePatterns(patterns: string[], file: string): string[] {

8585

return patterns.filter((pattern) => path.matchesGlob(file, pattern));

8686

}

878788+

function requireTestConfig<T extends { test?: unknown }>(config: T): NonNullable<T["test"]> {

89+

expect(config.test).toBeDefined();

90+

if (!config.test) {

91+

throw new Error("expected scoped vitest test config");

92+

}

93+

return config.test as NonNullable<T["test"]>;

94+

}

95+8896

describe("resolveVitestIsolation", () => {

8997

it("aliases private QA plugin SDK subpaths for source tests only", () => {

9098

expect(sharedVitestConfig.resolve.alias).toEqual(

@@ -120,19 +128,21 @@ describe("resolveVitestIsolation", () => {

120128121129

it("resolves scoped discovery dirs from the repo root after config relocation", () => {

122130

const config = createExtensionMatrixVitestConfig({});

131+

const testConfig = requireTestConfig(config);

123132124133

expect(config.root).toBe(process.cwd());

125-

expect(config.test?.dir).toBe(path.join(process.cwd(), "extensions"));

126-

expect(config.test?.include).toContain("matrix/**/*.test.ts");

134+

expect(testConfig.dir).toBe(path.join(process.cwd(), "extensions"));

135+

expect(testConfig.include).toContain("matrix/**/*.test.ts");

127136

});

128137

});

129138130139

describe("createScopedVitestConfig", () => {

131140

it("applies the non-isolated runner by default", () => {

132141

const config = createScopedVitestConfig(["src/example.test.ts"], { env: {} });

133-

expect(config.test?.isolate).toBe(false);

134-

expect(normalizeConfigPath(config.test?.runner)).toBe("test/non-isolated-runner.ts");

135-

expect(normalizeConfigPaths(config.test?.setupFiles)).toEqual([

142+

const testConfig = requireTestConfig(config);

143+

expect(testConfig.isolate).toBe(false);

144+

expect(normalizeConfigPath(testConfig.runner)).toBe("test/non-isolated-runner.ts");

145+

expect(normalizeConfigPaths(testConfig.setupFiles)).toEqual([

136146

"test/setup.ts",

137147

"test/setup-openclaw-runtime.ts",

138148

]);

@@ -143,8 +153,9 @@ describe("createScopedVitestConfig", () => {

143153

dir: "src",

144154

env: {},

145155

});

146-

expect(config.test?.dir).toBe(path.join(process.cwd(), "src"));

147-

expect(config.test?.include).toEqual(["example.test.ts"]);

156+

const testConfig = requireTestConfig(config);

157+

expect(testConfig.dir).toBe(path.join(process.cwd(), "src"));

158+

expect(testConfig.include).toEqual(["example.test.ts"]);

148159

});

149160150161

it("keeps scoped cli directory filters aligned with repo-root include patterns", () => {

@@ -155,7 +166,7 @@ describe("createScopedVitestConfig", () => {

155166

passWithNoTests: true,

156167

});

157168158-

expect(config.test?.include).toEqual(["slack/**/*.test.*"]);

169+

expect(requireTestConfig(config).include).toEqual(["slack/**/*.test.*"]);

159170

});

160171161172

it("keeps broad scoped cli directory filters aligned with repo-root include patterns", () => {

@@ -166,7 +177,7 @@ describe("createScopedVitestConfig", () => {

166177

passWithNoTests: true,

167178

});

168179169-

expect(config.test?.include).toEqual(["speech-core/**/*.test.*"]);

180+

expect(requireTestConfig(config).include).toEqual(["speech-core/**/*.test.*"]);

170181

});

171182172183

it("relativizes scoped include and exclude patterns to the configured dir", () => {

@@ -175,9 +186,10 @@ describe("createScopedVitestConfig", () => {

175186

env: {},

176187

exclude: [EXTENSIONS_CHANNEL_GLOB, "dist/**"],

177188

});

189+

const testConfig = requireTestConfig(config);

178190179-

expect(config.test?.include).toEqual(["**/*.test.ts"]);

180-

expect(config.test?.exclude).toEqual(expect.arrayContaining(["channel/**", "dist/**"]));

191+

expect(testConfig.include).toEqual(["**/*.test.ts"]);

192+

expect(testConfig.exclude).toEqual(expect.arrayContaining(["channel/**", "dist/**"]));

181193

});

182194183195

it("narrows scoped includes to matching CLI file filters", () => {

@@ -186,9 +198,10 @@ describe("createScopedVitestConfig", () => {

186198

dir: "extensions",

187199

env: {},

188200

});

201+

const testConfig = requireTestConfig(config);

189202190-

expect(config.test?.include).toEqual(["browser/index.test.ts"]);

191-

expect(config.test?.passWithNoTests).toBe(true);

203+

expect(testConfig.include).toEqual(["browser/index.test.ts"]);

204+

expect(testConfig.passWithNoTests).toBe(true);

192205

});

193206194207

it("loads scoped include overrides from OPENCLAW_VITEST_INCLUDE_FILE", () => {

@@ -204,7 +217,7 @@ describe("createScopedVitestConfig", () => {

204217

},

205218

});

206219207-

expect(config.test?.include).toEqual(["utils/utils-misc.test.ts"]);

220+

expect(requireTestConfig(config).include).toEqual(["utils/utils-misc.test.ts"]);

208221

} finally {

209222

fs.rmSync(tempDir, { recursive: true, force: true });

210223

}

@@ -216,15 +229,15 @@ describe("createScopedVitestConfig", () => {

216229

setupFiles: ["test/setup.extensions.ts"],

217230

});

218231219-

expect(normalizeConfigPaths(config.test?.setupFiles)).toEqual([

232+

expect(normalizeConfigPaths(requireTestConfig(config).setupFiles)).toEqual([

220233

"test/setup.ts",

221234

"test/setup.extensions.ts",

222235

"test/setup-openclaw-runtime.ts",

223236

]);

224237

});

225238226239

it("keeps bundled unit test includes out of the bundled exclude list", () => {

227-

const excludePatterns = bundledVitestConfig.test?.exclude ?? [];

240+

const excludePatterns = requireTestConfig(bundledVitestConfig).exclude ?? [];

228241

for (const file of bundledPluginDependentUnitTestFiles) {

229242

expect(

230243

excludePatterns.some((pattern) => bundledExcludePatternCouldMatchFile(pattern, file)),