mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Cleanup
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//import { spawnSync } from 'child_process';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import { _electron } from 'playwright';
|
||||
import { TestContext } from './context';
|
||||
@@ -12,21 +10,6 @@ import { UITest } from './uiTest';
|
||||
|
||||
export function setup(context: TestContext) {
|
||||
describe('Desktop', () => {
|
||||
/*
|
||||
// Reset working directory and clean up any existing Electron processes before each test
|
||||
// This is needed because the CLI test changes the cwd to a temp directory
|
||||
const originalCwd = process.cwd();
|
||||
beforeEach(async function () {
|
||||
process.chdir(originalCwd);
|
||||
if (os.platform() === 'darwin') {
|
||||
context.log('Killing existing Electron processes on macOS');
|
||||
spawnSync('pkill', ['-9', 'Electron'], { stdio: 'ignore' });
|
||||
// Wait for processes to fully terminate
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
if (context.platform === 'darwin-x64') {
|
||||
it('desktop-darwin-x64', async () => {
|
||||
const dir = await context.downloadAndUnpack('darwin');
|
||||
@@ -196,33 +179,16 @@ export function setup(context: TestContext) {
|
||||
async function testDesktopApp(entryPoint: string, options?: { universal?: boolean }) {
|
||||
const test = new UITest(context);
|
||||
const args = [
|
||||
//'--wait',
|
||||
//'--new-window',
|
||||
'--extensions-dir', test.extensionsDir,
|
||||
'--user-data-dir', test.userDataDir,
|
||||
test.workspaceDir
|
||||
];
|
||||
|
||||
process.chdir(test.workspaceDir);
|
||||
context.log(`Changed current directory to: ${test.workspaceDir}`);
|
||||
|
||||
// Start with full environment but remove VS Code specific variables that might cause interference
|
||||
const env: Record<string, string | undefined> = { ...process.env };
|
||||
/*
|
||||
delete env['VSCODE_IPC_HOOK'];
|
||||
delete env['VSCODE_IPC_HOOK_CLI'];
|
||||
delete env['VSCODE_NLS_CONFIG'];
|
||||
delete env['VSCODE_PORTABLE'];
|
||||
delete env['VSCODE_PID'];
|
||||
delete env['VSCODE_CWD'];
|
||||
delete env['VSCODE_CLI_DATA_DIR'];
|
||||
delete env['ELECTRON_RUN_AS_NODE'];
|
||||
*/
|
||||
|
||||
// For universal binary on x64 Mac, set ARCHPREFERENCE to ensure correct architecture
|
||||
if (options?.universal && os.arch() === 'x64') {
|
||||
env['ARCHPREFERENCE'] = 'x86_64';
|
||||
}
|
||||
// Ensure correct architecture preference for universal binary on x64 Mac.
|
||||
const env = {
|
||||
...process.env,
|
||||
ARCHPREFERENCE: options?.universal && context.platform === 'darwin-x64' ? 'x86_64' : undefined
|
||||
};
|
||||
|
||||
context.log(`Starting VS Code ${entryPoint} with args ${args.join(' ')}`);
|
||||
const app = await _electron.launch({ executablePath: entryPoint, args, env: env as Record<string, string> });
|
||||
|
||||
@@ -28,6 +28,12 @@ if (!options.quality) {
|
||||
const context = new TestContext(options.quality, options.commit, options.verbose);
|
||||
|
||||
describe('VS Code Sanity Tests', () => {
|
||||
beforeEach(() => {
|
||||
const cwd = context.createTempDir();
|
||||
process.chdir(cwd);
|
||||
context.log(`Changed working directory to: ${cwd}`);
|
||||
});
|
||||
|
||||
if (options.cleanup) {
|
||||
afterEach(() => {
|
||||
context.cleanup();
|
||||
|
||||
Reference in New Issue
Block a user