Revert "fix profile tests, path -> pathOrPaths, and exception"

This reverts commit e9e112a648.
This commit is contained in:
meganrogge 2021-03-18 18:11:39 -07:00
parent a5219a9350
commit 1b52d82871
4 changed files with 49 additions and 49 deletions

View file

@ -780,7 +780,7 @@ export class WorkerExtHostTerminalService extends BaseExtHostTerminalService {
}
public $getAvailableProfiles(quickLaunchOnly: boolean): Promise<ITerminalProfile[]> {
return new Promise(() => []);
throw new NotSupportedError();
}
public async $getDefaultShellAndArgs(useAutomationShell: boolean): Promise<IShellAndArgsDto> {

View file

@ -233,8 +233,8 @@ export interface ITerminalProfile {
}
export const enum ProfileSource {
gitbash = 'Git Bash',
pwsh = 'PowerShell'
'Git Bash',
'PowerShell'
}
export interface ITerminalExecutable {

View file

@ -95,7 +95,7 @@ export const terminalConfiguration: IConfigurationNode = {
source: 'Git Bash'
},
'Command Prompt': {
pathOrPaths:
path:
[
'${env:windir}\\Sysnative\\cmd.exe',
'${env:windir}\\System32\\cmd.exe'
@ -104,7 +104,7 @@ export const terminalConfiguration: IConfigurationNode = {
},
'Windows PowerShell': {
comment: 'note that this will not be included in the quickSelect drop down if another version of powershell is installed',
pathOrPaths:
path:
[
'${env:windir}\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe',
'${env:windir}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe'

View file

@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
// import * as assert from 'assert';
import { isWindows } from 'vs/base/common/platform';
import { ITerminalProfiles, ProfileSource } from 'vs/workbench/contrib/terminal/common/terminal';
import { detectAvailableProfiles, IStatProvider } from 'vs/workbench/contrib/terminal/node/terminalProfiles';
import { ITerminalProfiles } from 'vs/workbench/contrib/terminal/common/terminal';
// import { detectAvailableProfiles, IStatProvider } from 'vs/workbench/contrib/terminal/node/terminalProfiles';
export interface ITestTerminalConfig {
profiles: ITerminalProfiles;
@ -17,50 +17,50 @@ suite('Workbench - TerminalProfiles', () => {
suite('detectAvailableProfiles', () => {
if (isWindows) {
suite('detectAvailableWindowsProfiles', async () => {
test('should detect cmd prompt', async () => {
const _paths = ['C:\\WINDOWS\\System32\\cmd.exe'];
let config: ITestTerminalConfig = {
profiles: {
windows: {
'Command Prompt': { pathOrPaths: _paths }
},
linux: {},
osx: {},
},
detectWslProfiles: false
};
const profiles = await detectAvailableProfiles(true, undefined, config, undefined, undefined, createStatProvider(_paths));
const expected = [{ profileName: 'Command Prompt', path: _paths[0] }];
assert.deepStrictEqual(expected, profiles);
});
// test('should detect cmd prompt', async () => {
// const _paths = ['C:\\WINDOWS\\System32\\cmd.exe'];
// let config: ITestTerminalConfig = {
// profiles: {
// windows: {
// 'Command Prompt': { path: _paths }
// }
// },
// detectWslProfiles: false
// };
// const profiles = await detectAvailableProfiles(true, undefined, config, undefined, undefined, createStatProvider(_paths));
// const expected = [{ profileName: 'Command Prompt', path: _paths[0] }];
// assert.deepStrictEqual(expected, profiles);
// });
test('should detect Git Bash and provide login args', async () => {
const _paths = [`C:\\Program Files\\Git\\bin\\bash.exe`];
let config: ITestTerminalConfig = {
profiles: {
windows: {
'Git Bash': { source: ProfileSource.gitbash }
},
linux: {},
osx: {}
},
detectWslProfiles: false
};
const profiles = await detectAvailableProfiles(true, undefined, config, undefined, undefined, createStatProvider(_paths));
const expected = [{ profileName: 'Git Bash', path: _paths[0], args: ['--login'] }];
assert.deepStrictEqual(profiles, expected);
// const _paths = [`C:\\Program Files\\Git\\bin\\bash.exe`];
// let config: ITestTerminalConfig = {
// profiles: {
// windows: {
// 'Git Bash': {
// source: ProfileSource['Git Bash']
// },
// },
// linux: {},
// osx: {}
// },
// detectWslProfiles: false
// };
// const profiles = await detectAvailableProfiles(true, undefined, config, undefined, undefined, createStatProvider(_paths));
// const expected = [{ profileName: 'Git Bash', path: _paths[0], args: ['--login'] }];
// assert.deepStrictEqual(profiles, expected);
});
});
}
});
});
function createStatProvider(expectedPaths: string[]): IStatProvider {
const provider = {
stat(path: string) {
return expectedPaths.includes(path);
},
lstat(path: string) {
return expectedPaths.includes(path);
}
};
return provider;
}
// function createStatProvider(expectedPaths: string[]): IStatProvider {
// const provider = {
// stat(path: string) {
// return expectedPaths.includes(path);
// },
// lstat(path: string) {
// return expectedPaths.includes(path);
// }
// };
// return provider;
// }