11import { TerminalShellType } from '../../../api' ;
2- import { Terminal , TerminalShellType as VSCTerminalShellType } from 'vscode' ;
2+ import { Terminal } from 'vscode' ;
33import { identifyTerminalShell } from '../../../features/common/shellDetector' ;
44import assert from 'assert' ;
55import { isWindows } from '../../../common/utils/platformUtils' ;
@@ -26,38 +26,6 @@ function getNameByShellType(shellType: string): string {
2626 return shellType === 'unknown' ? '' : shellType ;
2727}
2828
29- function getVSCShellType ( shellType : string ) : VSCTerminalShellType | undefined {
30- try {
31- switch ( shellType ) {
32- case 'sh' :
33- return VSCTerminalShellType . Sh ;
34- case 'bash' :
35- return VSCTerminalShellType . Bash ;
36- case 'powershell' :
37- case 'pwsh' :
38- return VSCTerminalShellType . PowerShell ;
39- case 'cmd' :
40- return VSCTerminalShellType . CommandPrompt ;
41- case 'gitbash' :
42- return VSCTerminalShellType . GitBash ;
43- case 'zsh' :
44- return VSCTerminalShellType . Zsh ;
45- case 'ksh' :
46- return VSCTerminalShellType . Ksh ;
47- case 'fish' :
48- return VSCTerminalShellType . Fish ;
49- case 'cshell' :
50- return VSCTerminalShellType . Csh ;
51- case 'nushell' :
52- return VSCTerminalShellType . NuShell ;
53- default :
54- return undefined ;
55- }
56- } catch {
57- return undefined ;
58- }
59- }
60-
6129function getShellPath ( shellType : string ) : string | undefined {
6230 switch ( shellType ) {
6331 case 'sh' :
@@ -129,23 +97,22 @@ function expectedShellType(shellType: string): TerminalShellType {
12997}
13098
13199suite ( 'Shell Detector' , ( ) => {
132- testShellTypes . forEach ( ( shellType ) => {
133- if ( shellType === TerminalShellType . unknown ) {
100+ testShellTypes . forEach ( ( shell ) => {
101+ if ( shell === TerminalShellType . unknown ) {
134102 return ;
135103 }
136104
137- const name = getNameByShellType ( shellType ) ;
138- const vscShellType = getVSCShellType ( shellType ) ;
139- test ( `Detect ${ shellType } ` , ( ) => {
105+ const name = getNameByShellType ( shell ) ;
106+ test ( `Detect ${ shell } ` , ( ) => {
140107 const terminal = {
141108 name,
142- state : { shellType : vscShellType } ,
109+ state : { shell } ,
143110 creationOptions : {
144- shellPath : getShellPath ( shellType ) ,
111+ shellPath : getShellPath ( shell ) ,
145112 } ,
146113 } as Terminal ;
147114 const detected = identifyTerminalShell ( terminal ) ;
148- const expected = expectedShellType ( shellType ) ;
115+ const expected = expectedShellType ( shell ) ;
149116 assert . strictEqual ( detected , expected ) ;
150117 } ) ;
151118 } ) ;
0 commit comments