@@ -24,6 +24,79 @@ import { useAutoCleanupTempDirTracker } from "./helpers/temp-dir.js";
2424
2525const tempDirs = useAutoCleanupTempDirTracker ( afterEach ) ;
2626
27+ const standaloneBundledChannelSmokeFiles = [
28+ "scripts/test-built-bundled-channel-entry-smoke.mts" ,
29+ "scripts/lib/bundled-plugin-build-entries.mjs" ,
30+ "scripts/lib/bundled-plugin-paths.mjs" ,
31+ "scripts/lib/optional-bundled-clusters.mjs" ,
32+ "scripts/lib/package-root-args.mts" ,
33+ "scripts/lib/record-shared.mjs" ,
34+ "scripts/process-warning-filter.mts" ,
35+ ] ;
36+
37+ function runStandaloneBundledChannelSmoke ( entrySource : string ) {
38+ const rootDir = tempDirs . make ( "openclaw-prepack-standalone-smoke-" ) ;
39+ for ( const relativePath of standaloneBundledChannelSmokeFiles ) {
40+ const destination = path . join ( rootDir , relativePath ) ;
41+ mkdirSync ( path . dirname ( destination ) , { recursive : true } ) ;
42+ copyFileSync ( path . join ( process . cwd ( ) , relativePath ) , destination ) ;
43+ }
44+
45+ const packageRoot = path . join ( rootDir , "package" ) ;
46+ const extensionRoot = path . join ( packageRoot , "dist" , "extensions" , "fixture-channel" ) ;
47+ mkdirSync ( extensionRoot , { recursive : true } ) ;
48+ writeFileSync ( path . join ( packageRoot , "package.json" ) , '{"files":[]}\n' ) ;
49+ writeFileSync (
50+ path . join ( extensionRoot , "package.json" ) ,
51+ `${ JSON . stringify ( {
52+ name : "@openclaw/fixture-channel" ,
53+ openclaw : { channel : true , extensions : [ "./index.ts" ] } ,
54+ } ) } \n`,
55+ ) ;
56+ writeFileSync ( path . join ( extensionRoot , "index.js" ) , entrySource ) ;
57+
58+ return spawnSync (
59+ process . execPath ,
60+ [
61+ path . join ( rootDir , "scripts" , "test-built-bundled-channel-entry-smoke.mts" ) ,
62+ "--package-root" ,
63+ packageRoot ,
64+ ] ,
65+ {
66+ cwd : rootDir ,
67+ encoding : "utf8" ,
68+ env : {
69+ ...process . env ,
70+ OPENCLAW_BUNDLED_CHANNEL_SMOKE_INSTALLED_LAYOUT : "1" ,
71+ } ,
72+ stdio : [ "ignore" , "pipe" , "pipe" ] ,
73+ } ,
74+ ) ;
75+ }
76+
77+ describe ( "standalone bundled channel smoke" , ( ) => {
78+ it ( "runs without workspace packages linked at the root" , ( ) => {
79+ const result = runStandaloneBundledChannelSmoke ( `
80+ export default {
81+ kind: "bundled-channel-entry",
82+ loadChannelPlugin() {
83+ return { id: "fixture-channel" };
84+ },
85+ };
86+ ` ) ;
87+
88+ expect ( result . status , result . stderr ) . toBe ( 0 ) ;
89+ expect ( result . stdout ) . toContain ( "channel=1" ) ;
90+ } ) ;
91+
92+ it ( "rejects a non-record channel entry default export" , ( ) => {
93+ const result = runStandaloneBundledChannelSmoke ( "export default [];\n" ) ;
94+
95+ expect ( result . status ) . not . toBe ( 0 ) ;
96+ expect ( result . stderr ) . toContain ( "AssertionError" ) ;
97+ } ) ;
98+ } ) ;
99+
27100describe ( "collectSourcePackWorkspaceDependencyErrors" , ( ) => {
28101 it ( "rejects the plain source pack that pnpm rewrites without bundling @openclaw/ai" , ( ) => {
29102 const rootDir = tempDirs . make ( "openclaw-source-pack-workspace-" ) ;
0 commit comments