@@ -3,6 +3,7 @@ import os from "node:os";
33import path from "node:path" ;
44import { afterEach , describe , expect , it , vi } from "vitest" ;
55import { importFreshModule } from "../../../test/helpers/import-fresh.ts" ;
6+ import { loadPluginManifestRegistry } from "../../plugins/manifest-registry.js" ;
67
78afterEach ( ( ) => {
89 vi . doUnmock ( "../../plugins/discovery.js" ) ;
@@ -12,6 +13,10 @@ afterEach(() => {
1213} ) ;
1314
1415describe ( "bundled channel entry shape guards" , ( ) => {
16+ const bundledPluginRoots = loadPluginManifestRegistry ( { cache : true , config : { } } )
17+ . plugins . filter ( ( plugin ) => plugin . origin === "bundled" )
18+ . map ( ( plugin ) => plugin . rootDir ) ;
19+
1520 it ( "treats missing bundled discovery results as empty" , async ( ) => {
1621 vi . doMock ( "../../plugins/discovery.js" , ( ) => ( {
1722 discoverOpenClawPlugins : ( ) => ( {
@@ -35,14 +40,9 @@ describe("bundled channel entry shape guards", () => {
3540 expect ( bundled . listBundledChannelSetupPlugins ( ) ) . toEqual ( [ ] ) ;
3641 } ) ;
3742 it ( "keeps channel entrypoints on the dedicated entry-contract SDK surface" , ( ) => {
38- const extensionRoot = path . resolve ( "extensions" ) ;
3943 const offenders : string [ ] = [ ] ;
4044
41- for ( const extensionId of fs . readdirSync ( extensionRoot ) ) {
42- const extensionDir = path . join ( extensionRoot , extensionId ) ;
43- if ( ! fs . statSync ( extensionDir ) . isDirectory ( ) ) {
44- continue ;
45- }
45+ for ( const extensionDir of bundledPluginRoots ) {
4646 for ( const relativePath of [ "index.ts" , "channel-entry.ts" , "setup-entry.ts" ] ) {
4747 const filePath = path . join ( extensionDir , relativePath ) ;
4848 if ( ! fs . existsSync ( filePath ) ) {
@@ -69,14 +69,9 @@ describe("bundled channel entry shape guards", () => {
6969 } ) ;
7070
7171 it ( "keeps bundled channel entrypoints free of static src imports" , ( ) => {
72- const extensionRoot = path . resolve ( "extensions" ) ;
7372 const offenders : string [ ] = [ ] ;
7473
75- for ( const extensionId of fs . readdirSync ( extensionRoot ) ) {
76- const extensionDir = path . join ( extensionRoot , extensionId ) ;
77- if ( ! fs . statSync ( extensionDir ) . isDirectory ( ) ) {
78- continue ;
79- }
74+ for ( const extensionDir of bundledPluginRoots ) {
8075 for ( const relativePath of [ "index.ts" , "channel-entry.ts" , "setup-entry.ts" ] ) {
8176 const filePath = path . join ( extensionDir , relativePath ) ;
8277 if ( ! fs . existsSync ( filePath ) ) {
@@ -99,14 +94,9 @@ describe("bundled channel entry shape guards", () => {
9994 } ) ;
10095
10196 it ( "keeps channel implementations off the broad core SDK surface" , ( ) => {
102- const extensionRoot = path . resolve ( "extensions" ) ;
10397 const offenders : string [ ] = [ ] ;
10498
105- for ( const extensionId of fs . readdirSync ( extensionRoot ) ) {
106- const extensionDir = path . join ( extensionRoot , extensionId ) ;
107- if ( ! fs . statSync ( extensionDir ) . isDirectory ( ) ) {
108- continue ;
109- }
99+ for ( const extensionDir of bundledPluginRoots ) {
110100 for ( const relativePath of [ "src/channel.ts" , "src/plugin.ts" ] ) {
111101 const filePath = path . join ( extensionDir , relativePath ) ;
112102 if ( ! fs . existsSync ( filePath ) ) {
0 commit comments