Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .eslint-allowed-bracket-notation-files
Original file line number Diff line number Diff line change
Expand Up @@ -508,26 +508,6 @@ extensions/git/src/ipc/ipcClient.ts
extensions/git/src/ipc/ipcServer.ts
extensions/git/src/util.ts

# Test infrastructure (18 files)
src/vs/platform/instantiation/test/common/instantiationServiceMock.ts
src/vs/workbench/test/browser/componentFixtures/chat/chatWidget.fixture.ts
src/vs/workbench/test/browser/componentFixtures/multiDiffEditorScroll.fixture.ts
src/vs/workbench/test/browser/componentFixtures/resizeObserver.fixture.ts
test/automation/src/electron.ts
test/automation/src/scm.ts
test/automation/src/search.ts
test/componentFixtures/playwright/tests/chatResizeObserver.spec.ts
test/componentFixtures/playwright/tests/utils.ts
test/monaco/esm-check/esm-check.js
test/sanity/src/context.ts
test/sanity/src/main.ts
test/smoke/src/areas/agentsWindow/agentsWindow.test.ts
test/smoke/src/areas/preferences/preferences.test.ts
test/smoke/test/index.js
test/unit/electron/index.js
test/unit/electron/preload.js
test/unit/electron/renderer.js

# Workbench UI and remaining services (23 files)
src/vs/workbench/browser/parts/editor/editor.ts
src/vs/workbench/browser/parts/editor/editorGroupView.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ export class TestInstantiationService extends InstantiationService implements ID
private _getOrCreateService<T>(serviceMock: IServiceMock<T>, opts: SinonOptions, reset?: boolean): any {
const service: any = this._serviceCollection.get(serviceMock.id);
if (!reset && service) {
if (opts.mock && service['sinonOptions'] && !!service['sinonOptions'].mock) {
if (opts.mock && service.sinonOptions && !!service.sinonOptions.mock) {
return service;
}
if (opts.stub && service['sinonOptions'] && !!service['sinonOptions'].stub) {
if (opts.stub && service.sinonOptions && !!service.sinonOptions.stub) {
return service;
}
}
Expand All @@ -135,7 +135,7 @@ export class TestInstantiationService extends InstantiationService implements ID
private _createService(serviceMock: IServiceMock<any>, opts: SinonOptions): any {
serviceMock.service = serviceMock.service ? serviceMock.service : this._servciesMap.get(serviceMock.id);
const service = opts.mock ? sinon.mock(serviceMock.service) : this._createStub(serviceMock.service);
service['sinonOptions'] = opts;
service.sinonOptions = opts;
return service;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ export async function renderChatWidget(context: ComponentFixtureContext, options
? Math.max(0, Math.max(116, inputHeight) - inputHeight)
: Math.max(0, height - inputHeight);
listContainer.style.height = `${contentHeight}px`;
listContainer.dataset['expectedHeight'] = String(contentHeight);
listContainer.dataset.expectedHeight = String(contentHeight);
listWidget.layout(contentHeight, width);
} finally {
layouting = false;
Expand Down Expand Up @@ -807,7 +807,7 @@ async function renderResizeObserverLoopHarness(context: ComponentFixtureContext,
if (event instanceof ErrorEvent && event.message.includes('ResizeObserver loop')) {
warningCount++;
warnings.textContent = `Warnings: ${warningCount}`;
warnings.dataset['observerContext'] = dom.getRecentDisposableResizeObserverContextForLoopError(event.message, targetWindow) ?? event.message;
warnings.dataset.observerContext = dom.getRecentDisposableResizeObserverContextForLoopError(event.message, targetWindow) ?? event.message;
status.textContent = 'Captured ResizeObserver warning';
}
}));
Expand Down Expand Up @@ -908,11 +908,11 @@ async function renderDisabledPetResizeObserverProbe(context: ComponentFixtureCon
const status = dom.append(context.container, dom.$('.disabled-pet-resize-observer-status'));
status.role = 'status';
status.textContent = 'Running disabled pet observer probe';
status.dataset['warningCount'] = '0';
status.dataset.warningCount = '0';
context.disposableStore.add(dom.addDisposableListener(targetWindow, dom.EventType.ERROR, event => {
if (event instanceof ErrorEvent && event.message.includes('ResizeObserver loop')) {
status.dataset['warningCount'] = String(Number(status.dataset['warningCount']) + 1);
status.dataset['observerContext'] = dom.getRecentDisposableResizeObserverContextForLoopError(event.message, targetWindow) ?? event.message;
status.dataset.warningCount = String(Number(status.dataset.warningCount) + 1);
status.dataset.observerContext = dom.getRecentDisposableResizeObserverContextForLoopError(event.message, targetWindow) ?? event.message;
}
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ function parseSerializedFixtureState(text: string): ISerializedFixtureState {
if (!isJsonObject(value)) {
throw new Error('Fixture state must be a JSON object.');
}
const items = value['items'];
const items = value.items;
if (!Array.isArray(items)) {
throw new Error('Fixture state must contain an items array.');
}
Expand All @@ -720,24 +720,24 @@ function parseSerializedFixtureItem(value: JsonValue, index: number): ISerialize
if (!isJsonObject(value)) {
throw new Error(`items[${index}] must be a JSON object.`);
}
const bindingPhase = value['bindingPhase'];
const bindingPhase = value.bindingPhase;
if (!isBindingPhase(bindingPhase)) {
throw new Error(`items[${index}].bindingPhase must be unbound, binding, projecting, or active.`);
}
const path = `items[${index}]`;
const lineCount = value['lineCount'] === undefined
const lineCount = value.lineCount === undefined
? heightToLineCount(readNonNegativeNumber(value, 'fullHeight', true, path))
: readNonNegativeInteger(value, 'lineCount', path);
const geometryOscillationValue = value['geometryOscillation'];
const geometryOscillationValue = value.geometryOscillation;
const geometryOscillation = geometryOscillationValue === undefined
? createDefaultGeometryOscillation()
: parseSerializedGeometryOscillation(geometryOscillationValue, index, lineCount);
const topLineCountValue = value['topLineCount'];
const bottomLineCountValue = value['bottomLineCount'];
const legacyContentTopInset = value['contentTopInset'];
const mountLineCountsValue = value['mountLineCounts'];
const legacyMountHeightsValue = value['mountHeights'];
const unmountLineCountResetValue = value['unmountLineCountReset'];
const topLineCountValue = value.topLineCount;
const bottomLineCountValue = value.bottomLineCount;
const legacyContentTopInset = value.contentTopInset;
const mountLineCountsValue = value.mountLineCounts;
const legacyMountHeightsValue = value.mountHeights;
const unmountLineCountResetValue = value.unmountLineCountReset;
return {
label: readString(value, 'label', path),
lineCount,
Expand Down Expand Up @@ -787,12 +787,12 @@ function parseSerializedGeometryOscillation(value: JsonValue, index: number, lin
if (!isJsonObject(value)) {
throw new Error(`${path} must be a JSON object.`);
}
const ordering = value['ordering'];
const ordering = value.ordering;
if (!isGeometryChangeOrdering(ordering)) {
throw new Error(`${path}.ordering must be atomic, lines-first, or offset-first.`);
}
const normalizedOrdering = ordering === 'height-first' ? 'lines-first' : ordering;
if (value['topLineCountA'] !== undefined) {
if (value.topLineCountA !== undefined) {
return {
enabled: readBoolean(value, 'enabled', path),
topLineCountA: readNonNegativeInteger(value, 'topLineCountA', path),
Expand All @@ -802,7 +802,7 @@ function parseSerializedGeometryOscillation(value: JsonValue, index: number, lin
ordering: normalizedOrdering,
};
}
const location = value['location'];
const location = value.location;
if (location !== 'above' && location !== 'below') {
throw new Error(`${path}.location must be above or below when importing legacy height geometry.`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ function renderLoopContextProbe(context: ComponentFixtureContext): void {

const status = dom.append(context.container, dom.$('.resize-observer-context-status'));
status.textContent = 'Waiting for ResizeObserver loop warning';
status.dataset['warningCount'] = '0';
status.dataset.warningCount = '0';

const observation = context.disposableStore.add(new MutableDisposable<IDisposable>());
context.disposableStore.add(dom.addDisposableListener(targetWindow, dom.EventType.ERROR, event => {
if (!(event instanceof ErrorEvent) || !event.message.includes('ResizeObserver loop')) {
return;
}

status.dataset['warningCount'] = '1';
status.dataset['observerContext'] = dom.getRecentDisposableResizeObserverContextForLoopError(event.message, targetWindow) ?? '';
status.dataset.warningCount = '1';
status.dataset.observerContext = dom.getRecentDisposableResizeObserverContextForLoopError(event.message, targetWindow) ?? '';
status.textContent = 'Captured ResizeObserver loop warning';
observation.clear();
}));
Expand Down
8 changes: 4 additions & 4 deletions test/automation/src/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ export async function resolveElectronConfiguration(options: LaunchOptions): Prom
if (userDataDir) {
const remoteDataDir = `${userDataDir}-server`;
fs.mkdirSync(remoteDataDir, { recursive: true });
env['TESTRESOLVER_DATA_FOLDER'] = remoteDataDir;
env.TESTRESOLVER_DATA_FOLDER = remoteDataDir;
}
env['TESTRESOLVER_LOGS_FOLDER'] = join(logsPath, 'server');
env.TESTRESOLVER_LOGS_FOLDER = join(logsPath, 'server');
// Exercise the remote server's exit diagnostics (see `installServerProcessExitDiagnostics`
// in server-main.ts) so unexpected server exits are explained in the captured logs,
// even when running smoke tests locally (where `isCI` is false).
env['VSCODE_SERVER_EXIT_DIAGNOSTICS'] = '1';
env.VSCODE_SERVER_EXIT_DIAGNOSTICS = '1';
if (options.verbose) {
env['TESTRESOLVER_LOG_LEVEL'] = 'trace';
env.TESTRESOLVER_LOG_LEVEL = 'trace';
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/automation/src/scm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function toChange(element: IElement): Change {
const type = element.attributes['data-tooltip'] || '';

const actionElementList = findElements(element, e => /\baction-label\b/.test(e.className));
const actions = actionElementList.map(e => e.attributes['title']);
const actions = actionElementList.map(e => e.attributes.title);

return {
name: name.textContent || '',
Expand Down
4 changes: 2 additions & 2 deletions test/automation/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export class Search extends Viewlet {
}

async getSearchTooltip(): Promise<any> {
const icon = await this.code.waitForElement(`.activitybar .action-label.codicon.codicon-search-view-icon`, (el) => !!el?.attributes?.['title']);
return icon.attributes['title'];
const icon = await this.code.waitForElement(`.activitybar .action-label.codicon.codicon-search-view-icon`, (el) => !!el?.attributes?.title);
return icon.attributes.title;
}

async searchFor(text: string): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ for (const scenario of scenarios) {
const geometry = await page.locator('.interactive-list').evaluate(element => {
const list = element.querySelector<HTMLElement>('.monaco-list');
return {
expectedHeight: Number((element as HTMLElement).dataset['expectedHeight']),
expectedHeight: Number((element as HTMLElement).dataset.expectedHeight),
containerHeight: element.getBoundingClientRect().height,
listHeight: list?.getBoundingClientRect().height,
};
Expand Down
2 changes: 1 addition & 1 deletion test/componentFixtures/playwright/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { Page } from '@playwright/test';

function getBaseURL(): string {
const port = process.env['COMPONENT_EXPLORER_PORT'];
const port = process.env.COMPONENT_EXPLORER_PORT;
if (!port) {
throw new Error('COMPONENT_EXPLORER_PORT is not set. Is the webServer running?');
}
Expand Down
2 changes: 1 addition & 1 deletion test/monaco/esm-check/esm-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function run() {
await extractSourcesWithoutCSS();
const server = await startServer();

const browser = await playwright['chromium'].launch({
const browser = await playwright.chromium.launch({
headless: !DEBUG_TESTS,
devtools: DEBUG_TESTS
// slowMo: DEBUG_TESTS ? 2000 : 0
Expand Down
8 changes: 4 additions & 4 deletions test/sanity/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,9 @@ export class TestContext {
private getWindowsInstallDir(type: 'user' | 'system'): string {
let parentDir: string;
if (type === 'system') {
parentDir = process.env['ProgramW6432'] || process.env['PROGRAMFILES'] || '';
parentDir = process.env.ProgramW6432 || process.env.PROGRAMFILES || '';
} else {
parentDir = path.join(process.env['LOCALAPPDATA'] || '', 'Programs');
parentDir = path.join(process.env.LOCALAPPDATA || '', 'Programs');
}

switch (this.options.quality) {
Expand Down Expand Up @@ -1284,13 +1284,13 @@ export class TestContext {
return await webkit.launch({ headless });
}
case 'win32': {
const executablePath = process.env['PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH'] ?? 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe';
const executablePath = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH ?? 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe';
this.log(`Using Chromium executable at: ${executablePath}`);
return await chromium.launch({ headless, executablePath });
}
case 'linux':
default: {
const executablePath = process.env['PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH'] ?? '/usr/bin/chromium-browser';
const executablePath = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH ?? '/usr/bin/chromium-browser';
this.log(`Using Chromium executable at: ${executablePath}`);
return await chromium.launch({
headless,
Expand Down
2 changes: 1 addition & 1 deletion test/sanity/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const context = new TestContext({
cleanup: options.cleanup,
checkSigning: options['signing-check'],
headlessBrowser: options.headless,
downloadOnly: !options['detection'],
downloadOnly: !options.detection,
screenshotsDir: options['screenshots-dir'],
crashDumpsDir: options['crash-dumps-dir'],
artifactsDir: options['artifacts-dir'],
Expand Down
8 changes: 4 additions & 4 deletions test/smoke/src/areas/agentsWindow/agentsWindow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ export function setup(logger: Logger) {
// "from source" signal: parseQuality() also returns Quality.Dev for
// a `--build` product when VSCODE_QUALITY is unset, which would
// wrongly hard-fail a packaged build that legitimately lacks Codex.
const isFromSource = process.env['VSCODE_DEV'] === '1';
const isPublishBuild = (process.env['VSCODE_PUBLISH'] ?? '').toLowerCase() === 'true';
const isFromSource = process.env.VSCODE_DEV === '1';
const isPublishBuild = (process.env.VSCODE_PUBLISH ?? '').toLowerCase() === 'true';
if (isFromSource || isPublishBuild) {
throw new Error(`[Agents Window/Codex] Codex session type unexpectedly unavailable (VSCODE_DEV=${process.env['VSCODE_DEV'] ?? '<unset>'}, VSCODE_PUBLISH=${process.env['VSCODE_PUBLISH'] ?? '<unset>'}) — the SDK should be resolvable from node_modules (from source) or product.agentSdks.codex (publish build)`);
throw new Error(`[Agents Window/Codex] Codex session type unexpectedly unavailable (VSCODE_DEV=${process.env.VSCODE_DEV ?? '<unset>'}, VSCODE_PUBLISH=${process.env.VSCODE_PUBLISH ?? '<unset>'}) — the SDK should be resolvable from node_modules (from source) or product.agentSdks.codex (publish build)`);
}
logger.log('[Agents Window/Codex] Codex session type not available in this built product (no product.agentSdks.codex); skipping');
this.skip();
Expand All @@ -380,7 +380,7 @@ export function setup(logger: Logger) {
// optional dependency that npm silently skips when its install fails.
// A stale `node_modules` cache can thus have the shim but no binary, so
// fail fast here (from source) instead of timing out at spawn time.
if (process.env['VSCODE_DEV'] === '1') {
if (process.env.VSCODE_DEV === '1') {
const repoRoot = path.resolve(process.cwd(), '..', '..');
const platformPkgDir = path.join(repoRoot, 'node_modules', `@openai/codex-${process.platform}-${process.arch}`);
const binaryName = process.platform === 'win32' ? 'codex.exe' : 'codex';
Expand Down
4 changes: 2 additions & 2 deletions test/smoke/src/areas/preferences/preferences.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ export function setup(logger: Logger) {
await app.code.waitAndClick('.settings-editor .monaco-list-rows .setting-item-control select', 2, 2);
await app.code.waitAndClick('.context-view .monaco-list-row:nth-child(1) .option-text', 2, 2);
await app.workbench.settingsEditor.searchSettingsUI('test');
await app.code.waitForElements('.settings-editor .settings-toc-container', false, elements => elements.length === 1 && elements[0].attributes['style'].includes('width: 0px'));
await app.code.waitForElements('.settings-editor .settings-toc-container', false, elements => elements.length === 1 && elements[0].attributes.style.includes('width: 0px'));
await app.code.waitForElements('.settings-editor .settings-body .monaco-sash', false, elements => elements.length === 1 && elements[0].className.includes('disabled'));

// Show ToC when searching
await app.workbench.settingsEditor.searchSettingsUI('workbench.settings.settingsSearchTocBehavior');
await app.code.waitAndClick('.settings-editor .monaco-list-rows .setting-item-control select', 2, 2);
await app.code.waitAndClick('.context-view .monaco-list-row:nth-child(2) .option-text', 2, 2);
await app.workbench.settingsEditor.searchSettingsUI('test');
await app.code.waitForElements('.settings-editor .settings-toc-container', false, elements => elements.length === 1 && !elements[0].attributes['style'].includes('width: 0px'));
await app.code.waitForElements('.settings-editor .settings-toc-container', false, elements => elements.length === 1 && !elements[0].attributes.style.includes('width: 0px'));
await app.code.waitForElements('.settings-editor .settings-body .monaco-sash', false, elements => elements.length === 1 && !elements[0].className.includes('disabled'));
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/smoke/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const opts = minimist(args, {
string: ['f', 'g']
});

const suite = opts['web'] ? 'Browser Smoke Tests' : 'Desktop Smoke Tests';
const suite = opts.web ? 'Browser Smoke Tests' : 'Desktop Smoke Tests';

const options = {
color: true,
timeout: 2 * 60 * 1000,
slow: 30 * 1000,
grep: opts['f'] || opts['g'],
grep: opts.f || opts.g,
failZero: opts['fail-zero']
};

Expand Down
2 changes: 1 addition & 1 deletion test/unit/electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ if (crashReporterDirectory) {

crashReporter.start({
companyName: 'Microsoft',
productName: process.env['VSCODE_DEV'] ? `${product.nameShort} Dev` : product.nameShort,
productName: process.env.VSCODE_DEV ? `${product.nameShort} Dev` : product.nameShort,
uploadToServer: false,
compress: true
});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/electron/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
get execPath() { return process.execPath; },

cwd() {
return process.env['VSCODE_CWD'] || process.execPath.substr(0, process.execPath.lastIndexOf(process.platform === 'win32' ? '\\' : '/'));
return process.env.VSCODE_CWD || process.execPath.substr(0, process.execPath.lastIndexOf(process.platform === 'win32' ? '\\' : '/'));
},

getProcessMemoryInfo() {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/electron/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const coverage = require('../coverage');
const { pathToFileURL } = require('url');

// Disabled custom inspect. See #38847
if (util.inspect && util.inspect['defaultOptions']) {
util.inspect['defaultOptions'].customInspect = false;
if (util.inspect && util.inspect.defaultOptions) {
util.inspect.defaultOptions.customInspect = false;
}

// VSCODE_GLOBALS: package/product.json
Expand Down
Loading