mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 09:35:38 -05:00
* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9 * delete unused folders * distro * Bump build node version * update chokidar * FIx hygiene errors * distro * Fix extension lint issues * Remove strict-vscode * Add copyright header exemptions * Bump vscode-extension-telemetry to fix webpacking issue with zone.js * distro * Fix failing tests (revert marked.js back to current one until we decide to update) * Skip searchmodel test * Fix mac build * temp debug script loading * Try disabling coverage * log error too * Revert "log error too" This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f. * Revert "temp debug script loading" This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c. * Add comments explaining coverage disabling * Fix ansi_up loading issue * Merge latest from ads * Use newer option * Fix compile * add debug logging warn * Always log stack * log more * undo debug * Update to use correct base path (+cleanup) * distro * fix compile errors * Remove strict-vscode * Fix sql editors not showing * Show db dropdown input & fix styling * Fix more info in gallery * Fix gallery asset requests * Delete unused workflow * Fix tapable resolutions for smoke test compile error * Fix smoke compile * Disable crash reporting * Disable interactive Co-authored-by: ADS Merger <karlb@microsoft.com>
244 lines
6.5 KiB
TypeScript
244 lines
6.5 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { deepEqual, equal } from 'assert';
|
|
import { DEFAULT_TERMINAL_OSX } from 'vs/platform/externalTerminal/common/externalTerminal';
|
|
import { LinuxExternalTerminalService, MacExternalTerminalService, WindowsExternalTerminalService } from 'vs/platform/externalTerminal/node/externalTerminalService';
|
|
|
|
suite('ExternalTerminalService', () => {
|
|
let mockOnExit: Function;
|
|
let mockOnError: Function;
|
|
let mockConfig: any;
|
|
|
|
setup(() => {
|
|
mockConfig = {
|
|
terminal: {
|
|
explorerKind: 'external',
|
|
external: {
|
|
windowsExec: 'testWindowsShell',
|
|
osxExec: 'testOSXShell',
|
|
linuxExec: 'testLinuxShell'
|
|
}
|
|
}
|
|
};
|
|
mockOnExit = (s: any) => s;
|
|
mockOnError = (e: any) => e;
|
|
});
|
|
|
|
test(`WinTerminalService - uses terminal from configuration`, done => {
|
|
let testShell = 'cmd';
|
|
let testCwd = 'path/to/workspace';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
equal(command, testShell, 'shell should equal expected');
|
|
equal(args[args.length - 1], mockConfig.terminal.external.windowsExec, 'terminal should equal expected');
|
|
equal(opts.cwd, testCwd, 'opts.cwd should equal expected');
|
|
done();
|
|
return {
|
|
on: (evt: any) => evt
|
|
};
|
|
}
|
|
};
|
|
let testService = new WindowsExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testShell,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
|
|
test(`WinTerminalService - uses default terminal when configuration.terminal.external.windowsExec is undefined`, done => {
|
|
let testShell = 'cmd';
|
|
let testCwd = 'path/to/workspace';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
equal(args[args.length - 1], WindowsExternalTerminalService.getDefaultTerminalWindows(), 'terminal should equal expected');
|
|
done();
|
|
return {
|
|
on: (evt: any) => evt
|
|
};
|
|
}
|
|
};
|
|
mockConfig.terminal.external.windowsExec = undefined;
|
|
let testService = new WindowsExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testShell,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
|
|
test(`WinTerminalService - uses default terminal when configuration.terminal.external.windowsExec is undefined`, done => {
|
|
let testShell = 'cmd';
|
|
let testCwd = 'c:/foo';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
equal(opts.cwd, 'C:/foo', 'cwd should be uppercase regardless of the case that\'s passed in');
|
|
done();
|
|
return {
|
|
on: (evt: any) => evt
|
|
};
|
|
}
|
|
};
|
|
let testService = new WindowsExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testShell,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
|
|
test(`WinTerminalService - cmder should be spawned differently`, done => {
|
|
let testShell = 'cmd';
|
|
mockConfig.terminal.external.windowsExec = 'cmder';
|
|
let testCwd = 'c:/foo';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
deepEqual(args, ['C:/foo']);
|
|
equal(opts, undefined);
|
|
done();
|
|
return { on: (evt: any) => evt };
|
|
}
|
|
};
|
|
let testService = new WindowsExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testShell,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
|
|
test(`WinTerminalService - windows terminal should open workspace directory`, done => {
|
|
let testShell = 'wt';
|
|
let testCwd = 'c:/foo';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
equal(opts.cwd, 'C:/foo');
|
|
done();
|
|
return { on: (evt: any) => evt };
|
|
}
|
|
};
|
|
let testService = new WindowsExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testShell,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
|
|
test(`MacTerminalService - uses terminal from configuration`, done => {
|
|
let testCwd = 'path/to/workspace';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
equal(args[1], mockConfig.terminal.external.osxExec, 'terminal should equal expected');
|
|
done();
|
|
return {
|
|
on: (evt: any) => evt
|
|
};
|
|
}
|
|
};
|
|
let testService = new MacExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
|
|
test(`MacTerminalService - uses default terminal when configuration.terminal.external.osxExec is undefined`, done => {
|
|
let testCwd = 'path/to/workspace';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
equal(args[1], DEFAULT_TERMINAL_OSX, 'terminal should equal expected');
|
|
done();
|
|
return {
|
|
on: (evt: any) => evt
|
|
};
|
|
}
|
|
};
|
|
mockConfig.terminal.external.osxExec = undefined;
|
|
let testService = new MacExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
|
|
test(`LinuxTerminalService - uses terminal from configuration`, done => {
|
|
let testCwd = 'path/to/workspace';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
equal(command, mockConfig.terminal.external.linuxExec, 'terminal should equal expected');
|
|
equal(opts.cwd, testCwd, 'opts.cwd should equal expected');
|
|
done();
|
|
return {
|
|
on: (evt: any) => evt
|
|
};
|
|
}
|
|
};
|
|
let testService = new LinuxExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
|
|
test(`LinuxTerminalService - uses default terminal when configuration.terminal.external.linuxExec is undefined`, done => {
|
|
LinuxExternalTerminalService.getDefaultTerminalLinuxReady().then(defaultTerminalLinux => {
|
|
let testCwd = 'path/to/workspace';
|
|
let mockSpawner = {
|
|
spawn: (command: any, args: any, opts: any) => {
|
|
// assert
|
|
equal(command, defaultTerminalLinux, 'terminal should equal expected');
|
|
done();
|
|
return {
|
|
on: (evt: any) => evt
|
|
};
|
|
}
|
|
};
|
|
mockConfig.terminal.external.linuxExec = undefined;
|
|
let testService = new LinuxExternalTerminalService();
|
|
(<any>testService).spawnTerminal(
|
|
mockSpawner,
|
|
mockConfig,
|
|
testCwd,
|
|
mockOnExit,
|
|
mockOnError
|
|
);
|
|
});
|
|
});
|
|
});
|