@@ -56,28 +56,39 @@ describe("getShellConfig", () => {
5656 it ( "prefers bash when fish is default and bash is on PATH" , ( ) => {
5757 const binDir = createTempCommandDir ( tempDirs , [ { name : "bash" } ] ) ;
5858 process . env . PATH = binDir ;
59- const { shell } = getShellConfig ( ) ;
59+ const { shell, args } = getShellConfig ( ) ;
6060 expect ( shell ) . toBe ( path . join ( binDir , "bash" ) ) ;
61+ expect ( args ) . toEqual ( [ "--noprofile" , "--norc" , "-c" ] ) ;
6162 } ) ;
6263
6364 it ( "falls back to sh when fish is default and bash is missing" , ( ) => {
6465 const binDir = createTempCommandDir ( tempDirs , [ { name : "sh" } ] ) ;
6566 process . env . PATH = binDir ;
66- const { shell } = getShellConfig ( ) ;
67+ const { shell, args } = getShellConfig ( ) ;
6768 expect ( shell ) . toBe ( path . join ( binDir , "sh" ) ) ;
69+ expect ( args ) . toEqual ( [ "-c" ] ) ;
6870 } ) ;
6971
7072 it ( "falls back to env shell when fish is default and no sh is available" , ( ) => {
7173 process . env . PATH = "" ;
72- const { shell } = getShellConfig ( ) ;
74+ const { shell, args } = getShellConfig ( ) ;
7375 expect ( shell ) . toBe ( "/usr/bin/fish" ) ;
76+ expect ( args ) . toEqual ( [ "-c" ] ) ;
77+ } ) ;
78+
79+ it ( "uses zsh no-rc mode to avoid startup-file env overrides" , ( ) => {
80+ process . env . SHELL = "/bin/zsh" ;
81+ const { shell, args } = getShellConfig ( ) ;
82+ expect ( shell ) . toBe ( "/bin/zsh" ) ;
83+ expect ( args ) . toEqual ( [ "-f" , "-c" ] ) ;
7484 } ) ;
7585
7686 it ( "uses sh when SHELL is unset" , ( ) => {
7787 delete process . env . SHELL ;
7888 process . env . PATH = "" ;
79- const { shell } = getShellConfig ( ) ;
89+ const { shell, args } = getShellConfig ( ) ;
8090 expect ( shell ) . toBe ( "sh" ) ;
91+ expect ( args ) . toEqual ( [ "-c" ] ) ;
8192 } ) ;
8293
8394 it ( "falls back to sh on PATH when SHELL is /usr/bin/false" , ( ) => {
0 commit comments