Skip to content

Commit f867798

Browse files
authored
more fault tolerant for shell setting (#1100)
* more fault tolerant for shell setting * fix ci check
1 parent b3f78ed commit f867798

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/JestExt/run-shell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class RunShell {
4141
this.nonLoginShell = setting;
4242
this.loginShell = this.getLoginShell(setting);
4343
} else {
44-
if (setting.args.length > 0) {
44+
if (setting.args?.length > 0) {
4545
this._useLoginShell = true;
4646
this.nonLoginShell = undefined;
4747
this.loginShell = setting;

tests/JestExt/run-shell.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('RunnerShell', () => {
3030
${6} | ${'darwin'} | ${{ path: 'bash', args: ['--login'] }} | ${{ path: 'bash', args: ['--login'] }} | ${true} | ${undefined}
3131
${7} | ${'linux'} | ${undefined} | ${LoginShells.sh} | ${false} | ${undefined}
3232
${8} | ${'linux'} | ${'whatever'} | ${undefined} | ${'never'} | ${undefined}
33+
${9} | ${'darwin'} | ${{ path: '/bin/zsh' }} | ${LoginShells.zsh} | ${false} | ${'/bin/zsh'}
3334
`('case $case', ({ platform, setting, loginShell, settingOverride, useLoginShell }) => {
3435
jest.clearAllMocks();
3536
mockPlatform.mockReturnValue(platform);

0 commit comments

Comments
 (0)