diff --git a/package-lock.json b/package-lock.json index f00cbb0a912e..bfbd316f269d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -128,7 +128,7 @@ "yargs": "^15.3.1" }, "engines": { - "vscode": "^1.78.0" + "vscode": "^1.78.0-20230421" } }, "node_modules/@azure/abort-controller": { diff --git a/package.json b/package.json index 8b364b5d60e6..a92875a230d4 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "theme": "dark" }, "engines": { - "vscode": "^1.78.0" + "vscode": "^1.78.0-20230421" }, "keywords": [ "python", diff --git a/src/test/debuggerTest.ts b/src/test/debuggerTest.ts index 36a0060b9303..949f14caee3d 100644 --- a/src/test/debuggerTest.ts +++ b/src/test/debuggerTest.ts @@ -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'; @@ -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); diff --git a/src/test/multiRootTest.ts b/src/test/multiRootTest.ts index 9a6d7cd1b904..c8c63b6dabe5 100644 --- a/src/test/multiRootTest.ts +++ b/src/test/multiRootTest.ts @@ -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 = ''; @@ -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); diff --git a/src/test/standardTest.ts b/src/test/standardTest.ts index c8416ebf1d7d..0562d1adf431 100644 --- a/src/test/standardTest.ts +++ b/src/test/standardTest.ts @@ -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') { @@ -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 = diff --git a/src/test/utils/vscode.ts b/src/test/utils/vscode.ts index 44f745dbaf90..a10ceb2e8881 100644 --- a/src/test/utils/vscode.ts +++ b/src/test/utils/vscode.ts @@ -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'; }