@@ -100,6 +100,27 @@ test('resolveSpawnConfig falls back to the default directory when explicit cwd i
100100 assert . equal ( config . rows , 40 ) ;
101101} ) ;
102102
103+ test ( 'resolveSpawnConfig treats empty args array as no-override and applies -l' , ( ) => {
104+ // Regression: detectAvailableShells returns args:[] on Unix, which used to
105+ // suppress the -l fallback (empty array is truthy). That caused the login
106+ // shell to skip ~/.zprofile, leaving Homebrew/asdf off PATH and producing
107+ // "asdf_update_java_home: command not found: asdf" on every prompt.
108+ const config = resolveSpawnConfig (
109+ { args : [ ] } ,
110+ {
111+ platform : 'darwin' ,
112+ env : { SHELL : '/bin/zsh' } ,
113+ osModule : {
114+ homedir : ( ) => '/Users/tester' ,
115+ tmpdir : ( ) => '/tmp/fallback' ,
116+ } ,
117+ } ,
118+ ) ;
119+
120+ assert . equal ( config . shell , '/bin/zsh' ) ;
121+ assert . deepEqual ( config . shellArgs , [ '-l' ] ) ;
122+ } ) ;
123+
103124test ( 'resolveSpawnConfig skips -l for csh' , ( ) => {
104125 const config = resolveSpawnConfig ( undefined , {
105126 platform : 'darwin' ,
@@ -223,21 +244,20 @@ test('resolveSpawnConfig uses explicit shell with default args fallback', () =>
223244 assert . deepEqual ( config . shellArgs , [ '-l' ] ) ;
224245} ) ;
225246
226- test ( 'resolveSpawnConfig uses explicit args with empty array ' , ( ) => {
247+ test ( 'resolveSpawnConfig honors non-empty explicit args (e.g. WSL distro flags) ' , ( ) => {
227248 const config = resolveSpawnConfig (
228- { args : [ ] } ,
249+ { args : [ '-d' , 'Ubuntu' ] } ,
229250 {
230- platform : 'linux ' ,
231- env : { SHELL : '/bin/bash' } ,
251+ platform : 'win32 ' ,
252+ env : { } ,
232253 osModule : {
233- homedir : ( ) => '/home/ tester' ,
234- tmpdir : ( ) => '/tmp/fallback ' ,
254+ homedir : ( ) => 'C:\\Users\\ tester' ,
255+ tmpdir : ( ) => 'C:\\Temp ' ,
235256 } ,
236257 } ,
237258 ) ;
238259
239- assert . equal ( config . shell , '/bin/bash' ) ;
240- assert . deepEqual ( config . shellArgs , [ ] ) ;
260+ assert . deepEqual ( config . shellArgs , [ '-d' , 'Ubuntu' ] ) ;
241261} ) ;
242262
243263// ── detectAvailableShells ───────────────────────────────────────────────
0 commit comments