mirror of
https://github.com/Microsoft/vscode
synced 2024-09-12 21:24:38 +00:00
Revert "fix profile tests, path -> pathOrPaths, and exception"
This reverts commit e9e112a648
.
This commit is contained in:
parent
a5219a9350
commit
1b52d82871
|
@ -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> {
|
||||
|
|
|
@ -233,8 +233,8 @@ export interface ITerminalProfile {
|
|||
}
|
||||
|
||||
export const enum ProfileSource {
|
||||
gitbash = 'Git Bash',
|
||||
pwsh = 'PowerShell'
|
||||
'Git Bash',
|
||||
'PowerShell'
|
||||
}
|
||||
|
||||
export interface ITerminalExecutable {
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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;
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue