






















@@ -43,6 +43,19 @@ const MOCK_RELATIVE_MODULE_PATTERN =
4343const RELATIVE_CORE_HINT =
4444"Use openclaw/plugin-sdk/testing or a focused plugin-sdk test/runtime subpath instead of core internals.";
454546+const EXTENSION_TEST_HELPER_BRIDGE_FILES = [
47+"test/helpers/plugins/env.ts",
48+"test/helpers/plugins/fetch-mock.ts",
49+"test/helpers/plugins/media-understanding.ts",
50+"test/helpers/plugins/mock-http-response.ts",
51+"test/helpers/plugins/plugin-registration.ts",
52+"test/helpers/plugins/plugin-registry.ts",
53+"test/helpers/plugins/runtime-taskflow.ts",
54+"test/helpers/plugins/temp-dir.ts",
55+"test/helpers/plugins/temp-home.ts",
56+"test/helpers/plugins/typed-cases.ts",
57+];
58+4659function isExtensionTestFile(filePath: string): boolean {
4760return /\.test\.[cm]?[jt]sx?$/u.test(filePath) || /\.e2e\.test\.[cm]?[jt]sx?$/u.test(filePath);
4861}
@@ -109,7 +122,12 @@ function collectRelativeCoreImportOffenders(
109122110123function main() {
111124const extensionsDir = path.join(process.cwd(), "extensions");
112-const files = collectExtensionTestFiles(extensionsDir);
125+const files = [
126+ ...collectExtensionTestFiles(extensionsDir),
127+ ...EXTENSION_TEST_HELPER_BRIDGE_FILES.map((file) => path.join(process.cwd(), file)).filter(
128+(file) => fs.existsSync(file),
129+),
130+];
113131const offenders: Offender[] = [];
114132115133for (const file of files) {
@@ -130,7 +148,7 @@ function main() {
130148131149if (offenders.length > 0) {
132150console.error(
133-"Extension test files must stay on extension test bridges or public plugin-sdk surfaces.",
151+"Extension test files and helper bridges must stay on public plugin-sdk surfaces.",
134152);
135153for (const offender of offenders.toSorted((a, b) => a.file.localeCompare(b.file))) {
136154const location = offender.line
@@ -143,7 +161,7 @@ function main() {
143161}
144162145163console.log(
146-`OK: extension test files and support helpers avoid direct core test/internal imports (${files.length} checked).`,
164+`OK: extension test files, support helpers, and helper bridges avoid direct core test/internal imports (${files.length} checked).`,
147165);
148166}
149167此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。