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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
GbyAI
GbyAI
M
MIT News - Artificial intelligence
美团技术团队
罗磊的独立博客
雷峰网
雷峰网
量子位
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
D
Docker
小众软件
小众软件
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
WordPress大学
WordPress大学
V
V2EX
博客园_首页
腾讯CDC
The Cloudflare Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

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(test): reject missing explicit vitest files · opencla...
vincentkoc · 2026-05-26 · via Recent Commits to openclaw:main

@@ -1,4 +1,5 @@

11

import { spawn } from "node:child_process";

2+

import fs from "node:fs";

23

import { createRequire } from "node:module";

34

import path from "node:path";

45

import { isUiTestTarget, isUnitUiTestTarget } from "../test/vitest/vitest.ui-paths.mjs";

@@ -16,6 +17,60 @@ const ANSI_CSI_SUFFIX_RE = /^[0-?]*[ -/]*[@-~]/u;

1617

const SUPPRESSED_VITEST_STDERR_PATTERNS = ["[PLUGIN_TIMINGS]"];

1718

const UI_VITEST_CONFIG = "test/vitest/vitest.ui.config.ts";

1819

const UNIT_UI_VITEST_CONFIG = "test/vitest/vitest.unit-ui.config.ts";

20+

const EXPLICIT_TEST_FILE_RE = /\.(?:test|e2e|live)\.(?:[cm]?[jt]sx?)$/u;

21+

const GLOB_PATTERN_CHARS_RE = /[*?[\]{}]/u;

22+

const VITEST_OPTIONS_WITH_VALUE = new Set([

23+

"--attachmentsDir",

24+

"--bail",

25+

"--browser",

26+

"--config",

27+

"--configLoader",

28+

"-c",

29+

"--changed",

30+

"--dir",

31+

"--environment",

32+

"--exclude",

33+

"--execArgv",

34+

"--hookTimeout",

35+

"--inspect",

36+

"--inspect-brk",

37+

"--listTags",

38+

"--maxConcurrency",

39+

"--maxWorkers",

40+

"--mergeReports",

41+

"--mode",

42+

"--outputFile",

43+

"--pool",

44+

"--project",

45+

"--reporter",

46+

"--reporters",

47+

"--retry",

48+

"--root",

49+

"-r",

50+

"--sequence.shuffle.seed",

51+

"--shard",

52+

"--silent",

53+

"--slowTestThreshold",

54+

"--tagsFilter",

55+

"--teardownTimeout",

56+

"--testNamePattern",

57+

"-t",

58+

"--testTimeout",

59+

"--update",

60+

"-u",

61+

"--vmMemoryLimit",

62+

]);

63+

const VITEST_DOTTED_OPTIONS_WITH_VALUE_PREFIXES = [

64+

"--browser.",

65+

"--coverage.",

66+

"--diff.",

67+

"--expect.",

68+

"--experimental.",

69+

"--outputFile.",

70+

"--retry.",

71+

"--sequence.",

72+

"--typecheck.",

73+

];

1974

const require = createRequire(import.meta.url);

20752176

function isTruthyEnvValue(value) {

@@ -99,6 +154,69 @@ function hasExplicitVitestConfigArg(argv) {

99154

return argv.some((arg) => arg === "--config" || arg === "-c" || arg.startsWith("--config="));

100155

}

101156157+

function optionConsumesNextArg(arg) {

158+

if (arg.includes("=")) {

159+

return false;

160+

}

161+

return (

162+

VITEST_OPTIONS_WITH_VALUE.has(arg) ||

163+

VITEST_DOTTED_OPTIONS_WITH_VALUE_PREFIXES.some((prefix) => arg.startsWith(prefix))

164+

);

165+

}

166+167+

function isExplicitTestFileArg(arg) {

168+

if (!EXPLICIT_TEST_FILE_RE.test(arg) || GLOB_PATTERN_CHARS_RE.test(arg)) {

169+

return false;

170+

}

171+

return (

172+

path.isAbsolute(arg) || arg.startsWith("./") || arg.startsWith("../") || /[/\\]/u.test(arg)

173+

);

174+

}

175+176+

function collectExplicitTestFileArgs(argv) {

177+

const files = [];

178+

for (let index = 0; index < argv.length; index += 1) {

179+

const arg = argv[index];

180+

if (arg === "--") {

181+

break;

182+

}

183+

if (optionConsumesNextArg(arg)) {

184+

index += 1;

185+

continue;

186+

}

187+

if (arg.startsWith("-")) {

188+

continue;

189+

}

190+

if (isExplicitTestFileArg(arg)) {

191+

files.push(arg);

192+

}

193+

}

194+

return files;

195+

}

196+197+

function hasAlternateVitestRootArg(argv) {

198+

return argv.some(

199+

(arg) =>

200+

arg === "--root" ||

201+

arg === "-r" ||

202+

arg === "--dir" ||

203+

arg.startsWith("--root=") ||

204+

arg.startsWith("--dir="),

205+

);

206+

}

207+208+

export function resolveMissingExplicitTestFiles(argv, cwd = process.cwd(), fsImpl = fs) {

209+

if (hasExplicitVitestConfigArg(argv) || hasAlternateVitestRootArg(argv)) {

210+

return [];

211+

}

212+

return collectExplicitTestFileArgs(argv)

213+

.filter((arg) => {

214+

const filePath = path.isAbsolute(arg) ? arg : path.resolve(cwd, arg);

215+

return !fsImpl.existsSync(filePath);

216+

})

217+

.map((arg) => toRepoRelativeArg(arg, cwd));

218+

}

219+102220

function toRepoRelativeArg(arg, cwd) {

103221

const normalized = path.isAbsolute(arg) ? path.relative(cwd, arg) : arg;

104222

return normalized.replaceAll(path.sep, "/").replace(/^\.\//u, "");

@@ -309,6 +427,17 @@ function main(argv = process.argv.slice(2), env = process.env) {

309427

process.exit(1);

310428

}

311429430+

const missingTestFiles = resolveMissingExplicitTestFiles(argv);

431+

if (missingTestFiles.length > 0) {

432+

console.error(

433+

[

434+

"[vitest] explicit test file(s) not found:",

435+

...missingTestFiles.map((file) => ` - ${file}`),

436+

].join("\n"),

437+

);

438+

process.exit(1);

439+

}

440+312441

const vitestArgs = resolveImplicitVitestArgs(argv);

313442

const { child, teardown } = spawnWatchedVitestProcess({

314443

pnpmArgs: [