@@ -3,7 +3,7 @@ import * as fs from 'fs-extra';
33import * as os from 'os' ;
44import * as path from 'path' ;
55import { downloadAndUnzipVSCode , resolveCliPathFromVSCodeExecutablePath , runTests } from '@vscode/test-electron' ;
6- import { JUPYTER_EXTENSION_ID , PYLANCE_EXTENSION_ID } from '../client/common/constants' ;
6+ import { EXTENSION_ROOT_DIR , JUPYTER_EXTENSION_ID , PYLANCE_EXTENSION_ID } from '../client/common/constants' ;
77import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants' ;
88
99// If running smoke tests, we don't have access to this.
@@ -27,7 +27,20 @@ const extensionDevelopmentPath = process.env.CODE_EXTENSIONS_PATH
2727 ? process . env . CODE_EXTENSIONS_PATH
2828 : EXTENSION_ROOT_DIR_FOR_TESTS ;
2929
30- const channel = process . env . VSC_PYTHON_CI_TEST_VSC_CHANNEL || 'stable' ;
30+ async function getChannel ( ) : Promise < string > {
31+ if ( process . env . VSC_PYTHON_CI_TEST_VSC_CHANNEL ) {
32+ return process . env . VSC_PYTHON_CI_TEST_VSC_CHANNEL ;
33+ }
34+
35+ const packageJsonPath = path . join ( EXTENSION_ROOT_DIR , 'package.json' ) ;
36+ if ( await fs . pathExists ( packageJsonPath ) ) {
37+ const packageJson = await fs . readJSON ( packageJsonPath ) ;
38+ if ( packageJson . engines . vscode . endsWith ( 'insider' ) ) {
39+ return 'insiders' ;
40+ }
41+ }
42+ return 'stable' ;
43+ }
3144
3245/**
3346 * Smoke tests & tests running in VSCode require Jupyter extension to be installed.
@@ -77,6 +90,8 @@ async function installPylanceExtension(vscodeExecutablePath: string) {
7790async function start ( ) {
7891 console . log ( '*' . repeat ( 100 ) ) ;
7992 console . log ( 'Start Standard tests' ) ;
93+ const channel = await getChannel ( ) ;
94+ console . log ( `Using ${ channel } build of VS Code.` ) ;
8095 const vscodeExecutablePath = await downloadAndUnzipVSCode ( channel ) ;
8196 const baseLaunchArgs =
8297 requiresJupyterExtensionToBeInstalled ( ) || requiresPylanceExtensionToBeInstalled ( )
0 commit comments