Skip to content

update to node 22 and fix tests #25379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipeline.pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipeline.stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions build/azure-pipelines/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pythonExtensionApi/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pythonExtensionApi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
7 changes: 7 additions & 0 deletions src/client/common/process/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ export class ProcessLogger implements IProcessLogger {
});
}

/**
* 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) {
command = replaceMatchesWithCharacter(command, this.workspaceService.workspaceFolders[0].uri.fsPath, '.');
Expand Down
43 changes: 33 additions & 10 deletions src/test/common/process/logger.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});

Expand Down
Loading