From 0a86877a89a64932159b50bc9833f1acea72a03e Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Mon, 11 Aug 2025 10:43:38 -0700 Subject: [PATCH 1/9] update to node 22.17.0 --- .github/workflows/build.yml | 2 +- .github/workflows/pr-check.yml | 2 +- build/azure-pipeline.pre-release.yml | 2 +- build/azure-pipeline.stable.yml | 2 +- build/azure-pipelines/pipeline.yml | 6 +++--- pythonExtensionApi/package-lock.json | 2 +- pythonExtensionApi/package.json | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca75f6ef7727..16f398f5a166 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: permissions: {} env: - NODE_VERSION: 20.18.1 + NODE_VERSION: 22.17.0 PYTHON_VERSION: '3.10' # YML treats 3.10 the number as 3.1, so quotes around 3.10 # Force a path with spaces and to test extension works in these scenarios # Unicode characters are causing 2.7 failures so skip that for now. diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 65e80e1f6280..368d9d0dbb73 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -10,7 +10,7 @@ on: permissions: {} env: - NODE_VERSION: 20.18.1 + NODE_VERSION: 22.17.0 PYTHON_VERSION: '3.10' # YML treats 3.10 the number as 3.1, so quotes around 3.10 MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). Also enables a reporter which exits the process running the tests if it haven't already. ARTIFACT_NAME_VSIX: ms-python-insiders-vsix diff --git a/build/azure-pipeline.pre-release.yml b/build/azure-pipeline.pre-release.yml index ab087673f1e7..e7159618d3ae 100644 --- a/build/azure-pipeline.pre-release.yml +++ b/build/azure-pipeline.pre-release.yml @@ -66,7 +66,7 @@ extends: buildSteps: - task: NodeTool@0 inputs: - versionSpec: '20.18.1' + versionSpec: '22.17.0' displayName: Select Node version - task: UsePythonVersion@0 diff --git a/build/azure-pipeline.stable.yml b/build/azure-pipeline.stable.yml index c68dacc7db80..ce67c69a3df4 100644 --- a/build/azure-pipeline.stable.yml +++ b/build/azure-pipeline.stable.yml @@ -60,7 +60,7 @@ extends: buildSteps: - task: NodeTool@0 inputs: - versionSpec: '20.18.1' + versionSpec: '22.17.0' displayName: Select Node version - task: UsePythonVersion@0 diff --git a/build/azure-pipelines/pipeline.yml b/build/azure-pipelines/pipeline.yml index ebb8a141d9d3..46302aa6ff90 100644 --- a/build/azure-pipelines/pipeline.yml +++ b/build/azure-pipelines/pipeline.yml @@ -37,13 +37,13 @@ extends: testPlatforms: - name: Linux nodeVersions: - - 20.18.1 + - 22.17.0 - name: MacOS nodeVersions: - - 20.18.1 + - 22.17.0 - name: Windows nodeVersions: - - 20.18.1 + - 22.17.0 testSteps: - template: /build/azure-pipelines/templates/test-steps.yml@self parameters: diff --git a/pythonExtensionApi/package-lock.json b/pythonExtensionApi/package-lock.json index ec175f1aaa5d..e462fc1c888a 100644 --- a/pythonExtensionApi/package-lock.json +++ b/pythonExtensionApi/package-lock.json @@ -14,7 +14,7 @@ "typescript": "~5.2" }, "engines": { - "node": ">=20.18.1", + "node": ">=22.17.0", "vscode": "^1.93.0" } }, diff --git a/pythonExtensionApi/package.json b/pythonExtensionApi/package.json index 9a27e5a09b0a..e4e956ff6065 100644 --- a/pythonExtensionApi/package.json +++ b/pythonExtensionApi/package.json @@ -13,7 +13,7 @@ "main": "./out/main.js", "types": "./out/main.d.ts", "engines": { - "node": ">=20.18.1", + "node": ">=22.17.0", "vscode": "^1.93.0" }, "license": "MIT", @@ -27,7 +27,7 @@ }, "devDependencies": { "typescript": "~5.2", - "@types/vscode": "^1.93.0", + "@types/vscode": "^1.102.0", "source-map": "^0.8.0-beta.0" }, "scripts": { From 37c0301b690f6facc55dc854d9efaee2889cf2de Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:08:28 -0700 Subject: [PATCH 2/9] fix path creation for logger --- src/client/common/process/logger.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/client/common/process/logger.ts b/src/client/common/process/logger.ts index 47e9ef88fa4f..078f2b6d2e28 100644 --- a/src/client/common/process/logger.ts +++ b/src/client/common/process/logger.ts @@ -27,10 +27,10 @@ export class ProcessLogger implements IProcessLogger { let command = args ? [fileOrCommand, ...args].map((e) => e.trimQuotes().toCommandArgumentForPythonExt()).join(' ') : fileOrCommand; - const info = [`> ${this.getDisplayCommands(command)}`]; + const info = [`> ${this.getDisplayCommands(command, false)}`]; if (options?.cwd) { const cwd: string = typeof options?.cwd === 'string' ? options?.cwd : options?.cwd?.toString(); - info.push(`cwd: ${this.getDisplayCommands(cwd)}`); + info.push(`cwd: ${this.getDisplayCommands(cwd, true)}`); } if (typeof options?.shell === 'string') { info.push(`shell: ${identifyShellFromShellPath(options?.shell)}`); @@ -41,8 +41,9 @@ export class ProcessLogger implements IProcessLogger { }); } - private getDisplayCommands(command: string): string { - if (this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) { + private getDisplayCommands(command: string, isCwd: boolean = false): string { + // Only replace workspace paths with '.' for cwd + if (isCwd && this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) { command = replaceMatchesWithCharacter(command, this.workspaceService.workspaceFolders[0].uri.fsPath, '.'); } const home = getUserHomeDir(); From 8f0c9ac2f66a5f580eba125d7e200c88f4531e28 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:17:05 -0700 Subject: [PATCH 3/9] update tests --- src/test/common/process/logger.unit.test.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/test/common/process/logger.unit.test.ts b/src/test/common/process/logger.unit.test.ts index f1421ea58b85..7c6d0cf5b420 100644 --- a/src/test/common/process/logger.unit.test.ts +++ b/src/test/common/process/logger.unit.test.ts @@ -146,15 +146,18 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); - test('Logger replaces the path to workspace with . if exactly one workspace folder is opened', async () => { + test('Logger only replaces the workspace path with . in the working directory', async () => { const options = { cwd: path.join('path', 'to', 'workspace', 'debug', 'path') }; logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); + sinon.assert.calledWithExactly( + traceLogStub, + `> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, + ); sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`); }); - test('On Windows, logger replaces both backwards and forward slash version of path to workspace with . if exactly one workspace folder is opened', async function () { + test('On Windows, logger handles both forward and backward slashes in workspace paths for cwd', async function () { if (getOSType() !== OSType.Windows) { return this.skip(); } @@ -162,14 +165,20 @@ suite('ProcessLogger suite', () => { logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); + sinon.assert.calledWithExactly( + traceLogStub, + `> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, + ); sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`); traceLogStub.resetHistory(); options = { cwd: path.join('path\\to\\workspace', 'debug', 'path') }; logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); + sinon.assert.calledWithExactly( + traceLogStub, + `> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, + ); sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`); }); From 077b34877c8b550dc9a2d4c64d136d311299b7bb Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:43:53 -0700 Subject: [PATCH 4/9] update tests for new node relative path updates --- src/test/common/process/logger.unit.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/common/process/logger.unit.test.ts b/src/test/common/process/logger.unit.test.ts index 7c6d0cf5b420..1bfe94b43e95 100644 --- a/src/test/common/process/logger.unit.test.ts +++ b/src/test/common/process/logger.unit.test.ts @@ -111,7 +111,7 @@ suite('ProcessLogger suite', () => { const options = { cwd: path.join('debug', 'path') }; logger.logProcess(path.join('net', untildify('~'), 'test'), ['--foo', '--bar'], options); - sinon.assert.calledWithExactly(traceLogStub, `> ${path.join('net', '~', 'test')} --foo --bar`); + sinon.assert.calledWithExactly(traceLogStub, `> ${path.join('.', 'net', '~', 'test')} --foo --bar`); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); @@ -125,7 +125,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly( traceLogStub, - `> ${path.join('net', '~', 'test')} --foo ${path.join('~', 'boo')}`, + `> ${path.join('.', 'net', '~', 'test')} --foo ${path.join('~', 'boo')}`, ); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); @@ -134,7 +134,7 @@ suite('ProcessLogger suite', () => { const options = { cwd: path.join('debug', 'path') }; logger.logProcess(`"${path.join('net', untildify('~'), 'test')}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('net', '~', 'test')}" "--foo" "--bar"`); + sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('.', 'net', '~', 'test')}" "--foo" "--bar"`); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); From 1ae427009d56626f35d123e5e9e22302c3a292a8 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:44:20 -0700 Subject: [PATCH 5/9] revert logger changes --- src/client/common/process/logger.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/client/common/process/logger.ts b/src/client/common/process/logger.ts index 078f2b6d2e28..47e9ef88fa4f 100644 --- a/src/client/common/process/logger.ts +++ b/src/client/common/process/logger.ts @@ -27,10 +27,10 @@ export class ProcessLogger implements IProcessLogger { let command = args ? [fileOrCommand, ...args].map((e) => e.trimQuotes().toCommandArgumentForPythonExt()).join(' ') : fileOrCommand; - const info = [`> ${this.getDisplayCommands(command, false)}`]; + const info = [`> ${this.getDisplayCommands(command)}`]; if (options?.cwd) { const cwd: string = typeof options?.cwd === 'string' ? options?.cwd : options?.cwd?.toString(); - info.push(`cwd: ${this.getDisplayCommands(cwd, true)}`); + info.push(`cwd: ${this.getDisplayCommands(cwd)}`); } if (typeof options?.shell === 'string') { info.push(`shell: ${identifyShellFromShellPath(options?.shell)}`); @@ -41,9 +41,8 @@ export class ProcessLogger implements IProcessLogger { }); } - private getDisplayCommands(command: string, isCwd: boolean = false): string { - // Only replace workspace paths with '.' for cwd - if (isCwd && this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) { + private getDisplayCommands(command: string): string { + if (this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) { command = replaceMatchesWithCharacter(command, this.workspaceService.workspaceFolders[0].uri.fsPath, '.'); } const home = getUserHomeDir(); From b718b4f95ca44e5bf58d92a63cf85498152080e7 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Mon, 11 Aug 2025 12:00:58 -0700 Subject: [PATCH 6/9] node update testing --- src/client/common/process/logger.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/client/common/process/logger.ts b/src/client/common/process/logger.ts index 47e9ef88fa4f..61ff38856c47 100644 --- a/src/client/common/process/logger.ts +++ b/src/client/common/process/logger.ts @@ -27,10 +27,10 @@ export class ProcessLogger implements IProcessLogger { let command = args ? [fileOrCommand, ...args].map((e) => e.trimQuotes().toCommandArgumentForPythonExt()).join(' ') : fileOrCommand; - const info = [`> ${this.getDisplayCommands(command)}`]; + const info = [`> ${this.getDisplayCommands(command, false)}`]; if (options?.cwd) { const cwd: string = typeof options?.cwd === 'string' ? options?.cwd : options?.cwd?.toString(); - info.push(`cwd: ${this.getDisplayCommands(cwd)}`); + info.push(`cwd: ${this.getDisplayCommands(cwd, true)}`); } if (typeof options?.shell === 'string') { info.push(`shell: ${identifyShellFromShellPath(options?.shell)}`); @@ -41,9 +41,16 @@ export class ProcessLogger implements IProcessLogger { }); } - private getDisplayCommands(command: string): string { + private getDisplayCommands(command: string, isCwd: boolean = false): string { if (this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) { - command = replaceMatchesWithCharacter(command, this.workspaceService.workspaceFolders[0].uri.fsPath, '.'); + const workspacePath = this.workspaceService.workspaceFolders[0].uri.fsPath; + if (isCwd) { + // For working directory paths, replace workspace path with '.' + command = replaceMatchesWithCharacter(command, workspacePath, '.'); + } else if (command.includes(workspacePath)) { + // For command paths, make them relative to workspace by replacing workspace path with './' + command = command.replace(workspacePath, '.'); + } } const home = getUserHomeDir(); if (home) { From 043e08f0f77c9d05d9803d8d769239b665d6cfed Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Tue, 12 Aug 2025 10:38:05 -0700 Subject: [PATCH 7/9] reset --- .vscode/launch.json | 6 +++-- src/client/common/process/logger.ts | 22 +++++++++--------- src/test/common/process/logger.unit.test.ts | 25 +++++++-------------- 3 files changed, 23 insertions(+), 30 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1e983413c8d4..48b39b55f067 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -149,12 +149,14 @@ "--ui=tdd", "--recursive", "--colors", - //"--grep", "", + "--grep", + "ProcessLogger suite", "--timeout=300000" ], "outFiles": ["${workspaceFolder}/out/**/*.js", "!${workspaceFolder}/**/node_modules**/*"], "preLaunchTask": "Compile", - "skipFiles": ["/**"] + "skipFiles": ["/**"], + "runtimeExecutable": "/Users/eleanorboyd/.nvm/versions/node/v22.17.0/bin/node" }, { "name": "Unit Tests (fast, without VS Code and without react/monaco, *.unit.test.ts)", diff --git a/src/client/common/process/logger.ts b/src/client/common/process/logger.ts index 61ff38856c47..b65da8dc81e5 100644 --- a/src/client/common/process/logger.ts +++ b/src/client/common/process/logger.ts @@ -27,10 +27,10 @@ export class ProcessLogger implements IProcessLogger { let command = args ? [fileOrCommand, ...args].map((e) => e.trimQuotes().toCommandArgumentForPythonExt()).join(' ') : fileOrCommand; - const info = [`> ${this.getDisplayCommands(command, false)}`]; + const info = [`> ${this.getDisplayCommands(command)}`]; if (options?.cwd) { const cwd: string = typeof options?.cwd === 'string' ? options?.cwd : options?.cwd?.toString(); - info.push(`cwd: ${this.getDisplayCommands(cwd, true)}`); + info.push(`cwd: ${this.getDisplayCommands(cwd)}`); } if (typeof options?.shell === 'string') { info.push(`shell: ${identifyShellFromShellPath(options?.shell)}`); @@ -41,16 +41,16 @@ export class ProcessLogger implements IProcessLogger { }); } - private getDisplayCommands(command: string, isCwd: boolean = false): string { + /** + * Formats command strings for display by replacing common paths with symbols. + * - Replaces the workspace folder path with '.' if there's exactly one workspace folder + * - Replaces the user's home directory path with '~' + * @param command The command string to format + * @returns The formatted command string with paths replaced by symbols + */ + private getDisplayCommands(command: string): string { if (this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) { - const workspacePath = this.workspaceService.workspaceFolders[0].uri.fsPath; - if (isCwd) { - // For working directory paths, replace workspace path with '.' - command = replaceMatchesWithCharacter(command, workspacePath, '.'); - } else if (command.includes(workspacePath)) { - // For command paths, make them relative to workspace by replacing workspace path with './' - command = command.replace(workspacePath, '.'); - } + command = replaceMatchesWithCharacter(command, this.workspaceService.workspaceFolders[0].uri.fsPath, '.'); } const home = getUserHomeDir(); if (home) { diff --git a/src/test/common/process/logger.unit.test.ts b/src/test/common/process/logger.unit.test.ts index 1bfe94b43e95..f1421ea58b85 100644 --- a/src/test/common/process/logger.unit.test.ts +++ b/src/test/common/process/logger.unit.test.ts @@ -111,7 +111,7 @@ suite('ProcessLogger suite', () => { const options = { cwd: path.join('debug', 'path') }; logger.logProcess(path.join('net', untildify('~'), 'test'), ['--foo', '--bar'], options); - sinon.assert.calledWithExactly(traceLogStub, `> ${path.join('.', 'net', '~', 'test')} --foo --bar`); + sinon.assert.calledWithExactly(traceLogStub, `> ${path.join('net', '~', 'test')} --foo --bar`); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); @@ -125,7 +125,7 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly( traceLogStub, - `> ${path.join('.', 'net', '~', 'test')} --foo ${path.join('~', 'boo')}`, + `> ${path.join('net', '~', 'test')} --foo ${path.join('~', 'boo')}`, ); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); @@ -134,7 +134,7 @@ suite('ProcessLogger suite', () => { const options = { cwd: path.join('debug', 'path') }; logger.logProcess(`"${path.join('net', untildify('~'), 'test')}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('.', 'net', '~', 'test')}" "--foo" "--bar"`); + sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('net', '~', 'test')}" "--foo" "--bar"`); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); @@ -146,18 +146,15 @@ suite('ProcessLogger suite', () => { sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); - test('Logger only replaces the workspace path with . in the working directory', async () => { + test('Logger replaces the path to workspace with . if exactly one workspace folder is opened', async () => { const options = { cwd: path.join('path', 'to', 'workspace', 'debug', 'path') }; logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly( - traceLogStub, - `> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, - ); + sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`); }); - test('On Windows, logger handles both forward and backward slashes in workspace paths for cwd', async function () { + test('On Windows, logger replaces both backwards and forward slash version of path to workspace with . if exactly one workspace folder is opened', async function () { if (getOSType() !== OSType.Windows) { return this.skip(); } @@ -165,20 +162,14 @@ suite('ProcessLogger suite', () => { logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly( - traceLogStub, - `> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, - ); + sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`); traceLogStub.resetHistory(); options = { cwd: path.join('path\\to\\workspace', 'debug', 'path') }; logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly( - traceLogStub, - `> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, - ); + sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`); sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`); }); From cd7272ac196fd21db3f5538617758296fcc9dca8 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Tue, 12 Aug 2025 11:42:50 -0700 Subject: [PATCH 8/9] fix tests --- .vscode/launch.json | 3 +- src/test/common/process/logger.unit.test.ts | 43 ++++++++++++++++----- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 48b39b55f067..517b6bada82d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -149,8 +149,7 @@ "--ui=tdd", "--recursive", "--colors", - "--grep", - "ProcessLogger suite", + //"--grep", "", "--timeout=300000" ], "outFiles": ["${workspaceFolder}/out/**/*.js", "!${workspaceFolder}/**/node_modules**/*"], diff --git a/src/test/common/process/logger.unit.test.ts b/src/test/common/process/logger.unit.test.ts index f1421ea58b85..366a7056e89e 100644 --- a/src/test/common/process/logger.unit.test.ts +++ b/src/test/common/process/logger.unit.test.ts @@ -109,32 +109,55 @@ suite('ProcessLogger suite', () => { test('Logger replaces the path/to/home with ~ in the command path where the home path IS NOT at the beginning of the path', async () => { const options = { cwd: path.join('debug', 'path') }; - logger.logProcess(path.join('net', untildify('~'), 'test'), ['--foo', '--bar'], options); + const untildifyStr = untildify('~'); + + let p1 = path.join('net', untildifyStr, 'test'); + if (p1.startsWith('.')) { + if (getOSType() === OSType.Windows) { + p1 = p1.replace(/^\.\\+/, ''); + } else { + p1 = p1.replace(/^\.\\/, ''); + } + } + logger.logProcess(p1, ['--foo', '--bar'], options); - sinon.assert.calledWithExactly(traceLogStub, `> ${path.join('net', '~', 'test')} --foo --bar`); + const path1 = path.join('.', 'net', '~', 'test'); + sinon.assert.calledWithExactly(traceLogStub, `> ${path1} --foo --bar`); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); test('Logger replaces the path/to/home with ~ in the command path where the home path IS NOT at the beginning of the path but another arg contains other ref to home folder', async () => { const options = { cwd: path.join('debug', 'path') }; - logger.logProcess( - path.join('net', untildify('~'), 'test'), - ['--foo', path.join(untildify('~'), 'boo')], - options, - ); + let p1 = path.join('net', untildify('~'), 'test'); + if (p1.startsWith('.')) { + if (getOSType() === OSType.Windows) { + p1 = p1.replace(/^\.\\+/, ''); + } else { + p1 = p1.replace(/^\.\\/, ''); + } + } + logger.logProcess(p1, ['--foo', path.join(untildify('~'), 'boo')], options); sinon.assert.calledWithExactly( traceLogStub, - `> ${path.join('net', '~', 'test')} --foo ${path.join('~', 'boo')}`, + `> ${path.join('.', 'net', '~', 'test')} --foo ${path.join('~', 'boo')}`, ); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); test('Logger replaces the path/to/home with ~ in the command path where the home path IS NOT at the beginning of the path between doble quotes', async () => { const options = { cwd: path.join('debug', 'path') }; - logger.logProcess(`"${path.join('net', untildify('~'), 'test')}" "--foo" "--bar"`, undefined, options); + let p1 = path.join('net', untildify('~'), 'test'); + if (p1.startsWith('.')) { + if (getOSType() === OSType.Windows) { + p1 = p1.replace(/^\.\\+/, ''); + } else { + p1 = p1.replace(/^\.\\/, ''); + } + } + logger.logProcess(`"${p1}" "--foo" "--bar"`, undefined, options); - sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('net', '~', 'test')}" "--foo" "--bar"`); + sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('.', 'net', '~', 'test')}" "--foo" "--bar"`); sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`); }); From 271d60642d3815ec96cd884757766f0c2f97f73a Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Tue, 12 Aug 2025 11:54:46 -0700 Subject: [PATCH 9/9] remove leftover path --- .vscode/launch.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 517b6bada82d..1e983413c8d4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -154,8 +154,7 @@ ], "outFiles": ["${workspaceFolder}/out/**/*.js", "!${workspaceFolder}/**/node_modules**/*"], "preLaunchTask": "Compile", - "skipFiles": ["/**"], - "runtimeExecutable": "/Users/eleanorboyd/.nvm/versions/node/v22.17.0/bin/node" + "skipFiles": ["/**"] }, { "name": "Unit Tests (fast, without VS Code and without react/monaco, *.unit.test.ts)",