Skip to content

Commit fffb30f

Browse files
authored
update to node 22 and fix tests (#25379)
update to use node 22 update to use a higher version of vscode in the python api fix tests which began failing with node 22
1 parent 11fa35d commit fffb30f

File tree

9 files changed

+50
-20
lines changed

9 files changed

+50
-20
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
permissions: {}
1212

1313
env:
14-
NODE_VERSION: 20.18.1
14+
NODE_VERSION: 22.17.0
1515
PYTHON_VERSION: '3.10' # YML treats 3.10 the number as 3.1, so quotes around 3.10
1616
# Force a path with spaces and to test extension works in these scenarios
1717
# Unicode characters are causing 2.7 failures so skip that for now.

.github/workflows/pr-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
permissions: {}
1111

1212
env:
13-
NODE_VERSION: 20.18.1
13+
NODE_VERSION: 22.17.0
1414
PYTHON_VERSION: '3.10' # YML treats 3.10 the number as 3.1, so quotes around 3.10
1515
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.
1616
ARTIFACT_NAME_VSIX: ms-python-insiders-vsix

build/azure-pipeline.pre-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ extends:
6666
buildSteps:
6767
- task: NodeTool@0
6868
inputs:
69-
versionSpec: '20.18.1'
69+
versionSpec: '22.17.0'
7070
displayName: Select Node version
7171

7272
- task: UsePythonVersion@0

build/azure-pipeline.stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ extends:
6060
buildSteps:
6161
- task: NodeTool@0
6262
inputs:
63-
versionSpec: '20.18.1'
63+
versionSpec: '22.17.0'
6464
displayName: Select Node version
6565

6666
- task: UsePythonVersion@0

build/azure-pipelines/pipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ extends:
3737
testPlatforms:
3838
- name: Linux
3939
nodeVersions:
40-
- 20.18.1
40+
- 22.17.0
4141
- name: MacOS
4242
nodeVersions:
43-
- 20.18.1
43+
- 22.17.0
4444
- name: Windows
4545
nodeVersions:
46-
- 20.18.1
46+
- 22.17.0
4747
testSteps:
4848
- template: /build/azure-pipelines/templates/test-steps.yml@self
4949
parameters:

pythonExtensionApi/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pythonExtensionApi/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"main": "./out/main.js",
1414
"types": "./out/main.d.ts",
1515
"engines": {
16-
"node": ">=20.18.1",
16+
"node": ">=22.17.0",
1717
"vscode": "^1.93.0"
1818
},
1919
"license": "MIT",
@@ -27,7 +27,7 @@
2727
},
2828
"devDependencies": {
2929
"typescript": "~5.2",
30-
"@types/vscode": "^1.93.0",
30+
"@types/vscode": "^1.102.0",
3131
"source-map": "^0.8.0-beta.0"
3232
},
3333
"scripts": {

src/client/common/process/logger.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ export class ProcessLogger implements IProcessLogger {
4141
});
4242
}
4343

44+
/**
45+
* Formats command strings for display by replacing common paths with symbols.
46+
* - Replaces the workspace folder path with '.' if there's exactly one workspace folder
47+
* - Replaces the user's home directory path with '~'
48+
* @param command The command string to format
49+
* @returns The formatted command string with paths replaced by symbols
50+
*/
4451
private getDisplayCommands(command: string): string {
4552
if (this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) {
4653
command = replaceMatchesWithCharacter(command, this.workspaceService.workspaceFolders[0].uri.fsPath, '.');

src/test/common/process/logger.unit.test.ts

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,32 +109,55 @@ suite('ProcessLogger suite', () => {
109109

110110
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 () => {
111111
const options = { cwd: path.join('debug', 'path') };
112-
logger.logProcess(path.join('net', untildify('~'), 'test'), ['--foo', '--bar'], options);
112+
const untildifyStr = untildify('~');
113+
114+
let p1 = path.join('net', untildifyStr, 'test');
115+
if (p1.startsWith('.')) {
116+
if (getOSType() === OSType.Windows) {
117+
p1 = p1.replace(/^\.\\+/, '');
118+
} else {
119+
p1 = p1.replace(/^\.\\/, '');
120+
}
121+
}
122+
logger.logProcess(p1, ['--foo', '--bar'], options);
113123

114-
sinon.assert.calledWithExactly(traceLogStub, `> ${path.join('net', '~', 'test')} --foo --bar`);
124+
const path1 = path.join('.', 'net', '~', 'test');
125+
sinon.assert.calledWithExactly(traceLogStub, `> ${path1} --foo --bar`);
115126
sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`);
116127
});
117128

118129
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 () => {
119130
const options = { cwd: path.join('debug', 'path') };
120-
logger.logProcess(
121-
path.join('net', untildify('~'), 'test'),
122-
['--foo', path.join(untildify('~'), 'boo')],
123-
options,
124-
);
131+
let p1 = path.join('net', untildify('~'), 'test');
132+
if (p1.startsWith('.')) {
133+
if (getOSType() === OSType.Windows) {
134+
p1 = p1.replace(/^\.\\+/, '');
135+
} else {
136+
p1 = p1.replace(/^\.\\/, '');
137+
}
138+
}
139+
logger.logProcess(p1, ['--foo', path.join(untildify('~'), 'boo')], options);
125140

126141
sinon.assert.calledWithExactly(
127142
traceLogStub,
128-
`> ${path.join('net', '~', 'test')} --foo ${path.join('~', 'boo')}`,
143+
`> ${path.join('.', 'net', '~', 'test')} --foo ${path.join('~', 'boo')}`,
129144
);
130145
sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`);
131146
});
132147

133148
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 () => {
134149
const options = { cwd: path.join('debug', 'path') };
135-
logger.logProcess(`"${path.join('net', untildify('~'), 'test')}" "--foo" "--bar"`, undefined, options);
150+
let p1 = path.join('net', untildify('~'), 'test');
151+
if (p1.startsWith('.')) {
152+
if (getOSType() === OSType.Windows) {
153+
p1 = p1.replace(/^\.\\+/, '');
154+
} else {
155+
p1 = p1.replace(/^\.\\/, '');
156+
}
157+
}
158+
logger.logProcess(`"${p1}" "--foo" "--bar"`, undefined, options);
136159

137-
sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('net', '~', 'test')}" "--foo" "--bar"`);
160+
sinon.assert.calledWithExactly(traceLogStub, `> "${path.join('.', 'net', '~', 'test')}" "--foo" "--bar"`);
138161
sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`);
139162
});
140163

0 commit comments

Comments
 (0)