@@ -88,6 +88,13 @@ Deno.test({
8888
8989 const tempDir = await Deno . makeTempDir ( ) ;
9090 try {
91+ let optionalOpenCodePath : string | undefined ;
92+ try {
93+ optionalOpenCodePath = Deno . env . get ( "OPENCODE_BIN" ) ?? undefined ;
94+ } catch {
95+ optionalOpenCodePath = undefined ;
96+ }
97+
9198 const esmRunnerPath = join ( tempDir , "load-esm.mjs" ) ;
9299 const bunRunnerPath = join ( tempDir , "load-bun.mjs" ) ;
93100 const esmEntrypoint =
@@ -124,30 +131,34 @@ Deno.test({
124131 assertEquals ( bunLoad . stdout . trim ( ) , '["graphiti"]' ) ;
125132 }
126133
127- const localOpenCodePath = "/Users/vicary/.opencode/bin/opencode" ;
128- try {
129- const opencodeInfo = await Deno . stat ( localOpenCodePath ) ;
130- if ( opencodeInfo . isFile ) {
131- const isolatedOpenCode = await new Deno . Command ( localOpenCodePath , {
132- args : [ "--print-logs" , "stats" ] ,
133- cwd : workspacePath ,
134- env : {
135- HOME : isolatedHome ,
136- XDG_CONFIG_HOME : join ( isolatedHome , ".config" ) ,
137- } ,
138- stdout : "piped" ,
139- stderr : "piped" ,
140- } ) . output ( ) ;
141- const isolatedOpenCodeOutput = decodeText ( isolatedOpenCode . stdout ) +
142- decodeText ( isolatedOpenCode . stderr ) ;
143- assertEquals (
144- isolatedOpenCodeOutput . includes ( "Missing 'default' export" ) ,
145- false ,
146- isolatedOpenCodeOutput ,
147- ) ;
134+ if ( optionalOpenCodePath ) {
135+ try {
136+ const opencodeInfo = await Deno . stat ( optionalOpenCodePath ) ;
137+ if ( opencodeInfo . isFile ) {
138+ const isolatedOpenCode = await new Deno . Command (
139+ optionalOpenCodePath ,
140+ {
141+ args : [ "--print-logs" , "stats" ] ,
142+ cwd : workspacePath ,
143+ env : {
144+ HOME : isolatedHome ,
145+ XDG_CONFIG_HOME : join ( isolatedHome , ".config" ) ,
146+ } ,
147+ stdout : "piped" ,
148+ stderr : "piped" ,
149+ } ,
150+ ) . output ( ) ;
151+ const isolatedOpenCodeOutput = decodeText ( isolatedOpenCode . stdout ) +
152+ decodeText ( isolatedOpenCode . stderr ) ;
153+ assertEquals (
154+ isolatedOpenCodeOutput . includes ( "Missing 'default' export" ) ,
155+ false ,
156+ isolatedOpenCodeOutput ,
157+ ) ;
158+ }
159+ } catch {
160+ // OPENCODE_BIN is optional; keep the portable package checks above.
148161 }
149- } catch {
150- // OpenCode is not available in CI; keep the portable package checks above.
151162 }
152163 } finally {
153164 await Deno . remove ( tempDir , { recursive : true } ) . catch ( ( ) => undefined ) ;
0 commit comments