11import fs from "node:fs" ;
2- import { basename , dirname , resolve } from "node:path" ;
3- import { fileURLToPath } from "node:url" ;
2+ import { basename , resolve } from "node:path" ;
43import { beforeAll , describe , expect , it } from "vitest" ;
54import { expectNoReaddirSyncDuring } from "../../test-utils/fs-scan-assertions.js" ;
65import { listGitTrackedFiles , toRepoRelativePath } from "../../test-utils/repo-files.js" ;
@@ -19,8 +18,8 @@ type ExpectedSharedFamilyContract = {
1918 toolCompatFamilies ?: readonly string [ ] ;
2019} ;
2120
22- const SRC_ROOT = resolve ( dirname ( fileURLToPath ( import . meta . url ) ) , "../.." ) ;
23- const REPO_ROOT = resolve ( SRC_ROOT , ".. " ) ;
21+ const REPO_ROOT = resolve ( process . cwd ( ) ) ;
22+ const BUNDLED_SOURCE_EXTENSIONS_ROOT = resolve ( REPO_ROOT , "extensions " ) ;
2423const SHARED_FAMILY_HOOK_PATTERNS : ReadonlyArray < {
2524 kind : SharedFamilyHookKind ;
2625 regex : RegExp ;
@@ -111,7 +110,14 @@ function listBundledPluginRoots() {
111110 if ( bundledPluginRootsCache ) {
112111 return bundledPluginRootsCache ;
113112 }
114- bundledPluginRootsCache = loadPluginManifestRegistry ( { } )
113+ bundledPluginRootsCache = loadPluginManifestRegistry ( {
114+ workspaceDir : REPO_ROOT ,
115+ env : {
116+ ...process . env ,
117+ OPENCLAW_BUNDLED_PLUGINS_DIR : BUNDLED_SOURCE_EXTENSIONS_ROOT ,
118+ OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR : "1" ,
119+ } ,
120+ } )
115121 . plugins . filter ( ( plugin ) => plugin . origin === "bundled" )
116122 . map ( ( plugin ) => ( {
117123 pluginId : plugin . id ,
0 commit comments