diff --git a/package-lock.json b/package-lock.json index f2d39e4d2886..5ac653eb3eec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -131,7 +131,7 @@ "yargs": "^15.3.1" }, "engines": { - "vscode": "^1.68.0" + "vscode": "^1.73.0-insider" } }, "node_modules/@babel/code-frame": { diff --git a/package.json b/package.json index b6135364ab53..deff8950aebd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "theme": "dark" }, "engines": { - "vscode": "^1.68.0" + "vscode": "^1.73.0-insider" }, "keywords": [ "python", diff --git a/src/test/debuggerTest.ts b/src/test/debuggerTest.ts index 9217b85e391c..1abbbec76373 100644 --- a/src/test/debuggerTest.ts +++ b/src/test/debuggerTest.ts @@ -2,13 +2,29 @@ // Licensed under the MIT License. import * as path from 'path'; +import * as fs from 'fs-extra'; import { runTests } from '@vscode/test-electron'; import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants'; +import { EXTENSION_ROOT_DIR } from '../client/common/constants'; const workspacePath = path.join(__dirname, '..', '..', 'src', 'testMultiRootWkspc', 'multi.code-workspace'); process.env.IS_CI_SERVER_TEST_DEBUGGER = '1'; process.env.VSC_PYTHON_CI_TEST = '1'; -const channel = process.env.VSC_PYTHON_CI_TEST_VSC_CHANNEL || 'stable'; + +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); + if (packageJson.engines.vscode.endsWith('insider')) { + return 'insiders'; + } + } + return 'stable'; +} function start() { console.log('*'.repeat(100)); @@ -17,7 +33,7 @@ function start() { extensionDevelopmentPath: EXTENSION_ROOT_DIR_FOR_TESTS, extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'), launchArgs: [workspacePath], - version: channel, + version: getChannel(), extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' }, }).catch((ex) => { console.error('End Debugger tests (with errors)', ex); diff --git a/src/test/standardTest.ts b/src/test/standardTest.ts index 95b1e1cf42ee..f98136754822 100644 --- a/src/test/standardTest.ts +++ b/src/test/standardTest.ts @@ -3,7 +3,7 @@ import * as fs from 'fs-extra'; import * as os from 'os'; 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, JUPYTER_EXTENSION_ID, PYLANCE_EXTENSION_ID } from '../client/common/constants'; import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants'; // If running smoke tests, we don't have access to this. @@ -27,7 +27,20 @@ const extensionDevelopmentPath = process.env.CODE_EXTENSIONS_PATH ? process.env.CODE_EXTENSIONS_PATH : EXTENSION_ROOT_DIR_FOR_TESTS; -const channel = process.env.VSC_PYTHON_CI_TEST_VSC_CHANNEL || 'stable'; +async function getChannel(): Promise { + 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 (await fs.pathExists(packageJsonPath)) { + const packageJson = await fs.readJSON(packageJsonPath); + if (packageJson.engines.vscode.endsWith('insider')) { + return 'insiders'; + } + } + return 'stable'; +} /** * Smoke tests & tests running in VSCode require Jupyter extension to be installed. @@ -77,6 +90,8 @@ async function installPylanceExtension(vscodeExecutablePath: string) { async function start() { console.log('*'.repeat(100)); console.log('Start Standard tests'); + const channel = await getChannel(); + console.log(`Using ${channel} build of VS Code.`); const vscodeExecutablePath = await downloadAndUnzipVSCode(channel); const baseLaunchArgs = requiresJupyterExtensionToBeInstalled() || requiresPylanceExtensionToBeInstalled()