@@ -923,6 +923,31 @@ it.effect("does not try to install dependencies in read-only OPENCODE_CONFIG_DIR
923923 } ) . pipe ( Effect . provide ( testInstanceStoreLayer ) , Effect . provide ( LayerNode . compile ( CrossSpawnSpawner . node ) ) ) ,
924924)
925925
926+ it . effect ( "ignores an inaccessible OPENCODE_CONFIG_DIR" , ( ) =>
927+ Effect . gen ( function * ( ) {
928+ if ( process . platform === "win32" ) return
929+
930+ const dir = yield * tmpdirScoped ( )
931+ const configDir = path . join ( dir , "inaccessible" )
932+ yield * FSUtil . use . ensureDir ( configDir )
933+ yield * FSUtil . use . chmod ( configDir , 0o000 )
934+ yield * Effect . addFinalizer ( ( ) => FSUtil . use . chmod ( configDir , 0o755 ) . pipe ( Effect . ignore ) )
935+
936+ yield * withProcessEnv ( "OPENCODE_CONFIG_DIR" , configDir , Config . use . get ( ) . pipe ( provideInstanceEffect ( dir ) ) )
937+ } ) . pipe ( Effect . provide ( testInstanceStoreLayer ) , Effect . provide ( LayerNode . compile ( CrossSpawnSpawner . node ) ) ) ,
938+ )
939+
940+ it . effect ( "creates a missing OPENCODE_CONFIG_DIR" , ( ) =>
941+ Effect . gen ( function * ( ) {
942+ const dir = yield * tmpdirScoped ( )
943+ const configDir = path . join ( dir , "configdir" )
944+
945+ yield * withProcessEnv ( "OPENCODE_CONFIG_DIR" , configDir , Config . use . get ( ) . pipe ( provideInstanceEffect ( dir ) ) )
946+
947+ expect ( yield * FSUtil . use . readFileString ( path . join ( configDir , ".gitignore" ) ) ) . toContain ( "node_modules" )
948+ } ) . pipe ( Effect . provide ( testInstanceStoreLayer ) , Effect . provide ( LayerNode . compile ( CrossSpawnSpawner . node ) ) ) ,
949+ )
950+
926951it . effect ( "installs dependencies in writable OPENCODE_CONFIG_DIR" , ( ) =>
927952 Effect . gen ( function * ( ) {
928953 const dir = yield * tmpdirScoped ( )
0 commit comments