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

推荐订阅源

D
DataBreaches.Net
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
L
LangChain Blog
B
Blog
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
U
Unit 42
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿
小众软件
小众软件
I
InfoQ
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
C
Check Point 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: scope unit coverage gate · openclaw/openclaw@6455ed2
vincentkoc · 2026-05-06 · via Recent Commits to openclaw:main

@@ -1,14 +1,18 @@

1+

import fs from "node:fs";

2+

import path from "node:path";

13

import { defineConfig } from "vitest/config";

24

import { loadPatternListFromEnv, narrowIncludePatternsForCli } from "./vitest.pattern-file.ts";

35

import { resolveVitestIsolation } from "./vitest.scoped-config.ts";

46

import {

57

nonIsolatedRunnerPath,

8+

repoRoot,

69

resolveRepoRootPath,

710

sharedVitestConfig,

811

} from "./vitest.shared.config.ts";

912

import { getUnitFastTestFiles } from "./vitest.unit-fast-paths.mjs";

1013

import {

1114

isBundledPluginDependentUnitTestFile,

15+

isUnitConfigTestFile,

1216

unitTestAdditionalExcludePatterns,

1317

unitTestIncludePatterns,

1418

} from "./vitest.unit-paths.mjs";

@@ -28,6 +32,58 @@ export function loadExtraExcludePatternsFromEnv(

2832

return loadPatternListFromEnv("OPENCLAW_VITEST_EXTRA_EXCLUDE_FILE", env) ?? [];

2933

}

303435+

const defaultUnitCoverageRoots = ["src", "packages", "test"] as const;

36+37+

function toRepoPath(filePath: string): string {

38+

return path.relative(repoRoot, filePath).split(path.sep).join("/");

39+

}

40+41+

function collectTestFiles(dir: string): string[] {

42+

if (!fs.existsSync(dir)) {

43+

return [];

44+

}

45+

const files: string[] = [];

46+

for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {

47+

if (entry.name === "node_modules" || entry.name === "dist" || entry.name === "coverage") {

48+

continue;

49+

}

50+

const entryPath = path.join(dir, entry.name);

51+

if (entry.isDirectory()) {

52+

files.push(...collectTestFiles(entryPath));

53+

} else if (entry.isFile() && entry.name.endsWith(".test.ts")) {

54+

files.push(toRepoPath(entryPath));

55+

}

56+

}

57+

return files;

58+

}

59+60+

function resolveSiblingSourceFile(testFile: string): string | null {

61+

if (!testFile.endsWith(".test.ts")) {

62+

return null;

63+

}

64+

const sourceFile = testFile.replace(/\.test\.ts$/u, ".ts");

65+

return fs.existsSync(resolveRepoRootPath(sourceFile)) ? sourceFile : null;

66+

}

67+68+

export function resolveDefaultUnitCoverageIncludePatterns(

69+

unitFastTestFiles = getUnitFastTestFiles(),

70+

): string[] {

71+

const fastTestFiles = new Set(unitFastTestFiles);

72+

const sourceFiles = new Set<string>();

73+

for (const root of defaultUnitCoverageRoots) {

74+

for (const testFile of collectTestFiles(resolveRepoRootPath(root))) {

75+

if (!isUnitConfigTestFile(testFile) || fastTestFiles.has(testFile)) {

76+

continue;

77+

}

78+

const sourceFile = resolveSiblingSourceFile(testFile);

79+

if (sourceFile !== null) {

80+

sourceFiles.add(sourceFile);

81+

}

82+

}

83+

}

84+

return [...sourceFiles].toSorted((left, right) => left.localeCompare(right));

85+

}

86+3187

export function createUnitVitestConfigWithOptions(

3288

env: Record<string, string | undefined> = process.env,

3389

options: {

@@ -40,8 +96,15 @@ export function createUnitVitestConfigWithOptions(

4096

) {

4197

const isolate = resolveVitestIsolation(env);

4298

const unitFastTestFiles = getUnitFastTestFiles();

99+

const envIncludePatterns = loadIncludePatternsFromEnv(env);

43100

const defaultIncludePatterns = options.includePatterns ?? unitTestIncludePatterns;

44101

const cliIncludePatterns = narrowIncludePatternsForCli(defaultIncludePatterns, options.argv);

102+

const coverageIncludePatterns =

103+

options.includePatterns === undefined &&

104+

envIncludePatterns === null &&

105+

cliIncludePatterns === null

106+

? resolveDefaultUnitCoverageIncludePatterns(unitFastTestFiles)

107+

: null;

45108

const protectedIncludeFiles = new Set(

46109

defaultIncludePatterns.filter((pattern) => isBundledPluginDependentUnitTestFile(pattern)),

47110

);

@@ -66,7 +129,7 @@ export function createUnitVitestConfigWithOptions(

66129

),

67130

),

68131

],

69-

include: loadIncludePatternsFromEnv(env) ?? cliIncludePatterns ?? defaultIncludePatterns,

132+

include: envIncludePatterns ?? cliIncludePatterns ?? defaultIncludePatterns,

70133

exclude: [

71134

...new Set([

72135

...exclude,

@@ -78,6 +141,9 @@ export function createUnitVitestConfigWithOptions(

78141

],

79142

coverage: {

80143

...sharedTest.coverage,

144+

...(coverageIncludePatterns !== null && coverageIncludePatterns.length > 0

145+

? { include: coverageIncludePatterns }

146+

: {}),

81147

exclude: [

82148

...new Set([

83149

...(sharedTest.coverage?.exclude ?? []),