diff --git a/test/sanity/src/desktop.test.ts b/test/sanity/src/desktop.test.ts index 9cbab10e900..aa241403028 100644 --- a/test/sanity/src/desktop.test.ts +++ b/test/sanity/src/desktop.test.ts @@ -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 = { ...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 }); diff --git a/test/sanity/src/main.ts b/test/sanity/src/main.ts index f6a2b7d6084..ea038051d64 100644 --- a/test/sanity/src/main.ts +++ b/test/sanity/src/main.ts @@ -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();