Skip to content

Commit

Permalink
Revert "Remove hack to check the vscode version" (#21294)
Browse files Browse the repository at this point in the history
Reverts #21180
For #20769
  • Loading branch information
Kartik Raj authored May 24, 2023
1 parent a74f1d1 commit c9a7268
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"theme": "dark"
},
"engines": {
"vscode": "^1.78.0"
"vscode": "^1.78.0-20230421"
},
"keywords": [
"python",
Expand Down
4 changes: 2 additions & 2 deletions src/test/debuggerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import * as path from 'path';
import { runTests } from '@vscode/test-electron';
import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants';
import { getVersion } from './utils/vscode';
import { getChannel } from './utils/vscode';

const workspacePath = path.join(__dirname, '..', '..', 'src', 'testMultiRootWkspc', 'multi.code-workspace');
process.env.IS_CI_SERVER_TEST_DEBUGGER = '1';
Expand All @@ -17,7 +17,7 @@ function start() {
extensionDevelopmentPath: EXTENSION_ROOT_DIR_FOR_TESTS,
extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'),
launchArgs: [workspacePath],
version: getVersion(),
version: getChannel(),
extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' },
}).catch((ex) => {
console.error('End Debugger tests (with errors)', ex);
Expand Down
4 changes: 2 additions & 2 deletions src/test/multiRootTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path';
import { runTests } from '@vscode/test-electron';
import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants';
import { initializeLogger } from './testLogger';
import { getVersion } from './utils/vscode';
import { getChannel } from './utils/vscode';

const workspacePath = path.join(__dirname, '..', '..', 'src', 'testMultiRootWkspc', 'multi.code-workspace');
process.env.IS_CI_SERVER_TEST_DEBUGGER = '';
Expand All @@ -17,7 +17,7 @@ function start() {
extensionDevelopmentPath: EXTENSION_ROOT_DIR_FOR_TESTS,
extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'),
launchArgs: [workspacePath],
version: getVersion(),
version: getChannel(),
extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' },
}).catch((ex) => {
console.error('End Multiroot tests (with errors)', ex);
Expand Down
4 changes: 2 additions & 2 deletions src/test/standardTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as path from 'path';
import { downloadAndUnzipVSCode, resolveCliPathFromVSCodeExecutablePath, runTests } from '@vscode/test-electron';
import { JUPYTER_EXTENSION_ID, PYLANCE_EXTENSION_ID } from '../client/common/constants';
import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants';
import { getVersion } from './utils/vscode';
import { getChannel } from './utils/vscode';

// If running smoke tests, we don't have access to this.
if (process.env.TEST_FILES_SUFFIX !== 'smoke.test') {
Expand Down Expand Up @@ -76,7 +76,7 @@ async function installPylanceExtension(vscodeExecutablePath: string) {
async function start() {
console.log('*'.repeat(100));
console.log('Start Standard tests');
const channel = getVersion();
const channel = getChannel();
console.log(`Using ${channel} build of VS Code.`);
const vscodeExecutablePath = await downloadAndUnzipVSCode(channel);
const baseLaunchArgs =
Expand Down
12 changes: 10 additions & 2 deletions src/test/utils/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@ import * as path from 'path';
import * as fs from 'fs-extra';
import { EXTENSION_ROOT_DIR } from '../../client/common/constants';

export function getVersion(): string {
const insidersVersion = /^\^(\d+\.\d+\.\d+)-(insider|\d{8})$/;

export function getChannel(): string {
if (process.env.VSC_PYTHON_CI_TEST_VSC_CHANNEL) {
return process.env.VSC_PYTHON_CI_TEST_VSC_CHANNEL;
}
const packageJsonPath = path.join(EXTENSION_ROOT_DIR, 'package.json');
if (fs.pathExistsSync(packageJsonPath)) {
const packageJson = fs.readJSONSync(packageJsonPath);
return packageJson.engines.vscode.replace('^', '');
const engineVersion = packageJson.engines.vscode;
if (insidersVersion.test(engineVersion)) {
// Can't pass in the version number for an insiders build;
// https://github.com/microsoft/vscode-test/issues/176
return 'insiders';
}
return engineVersion.replace('^', '');
}
return 'stable';
}

0 comments on commit c9a7268

Please sign in to comment.