diff --git a/docs/Test-Setup.md b/docs/Test-Setup.md index ef4f36516..aa8bfaa1b 100644 --- a/docs/Test-Setup.md +++ b/docs/Test-Setup.md @@ -82,6 +82,7 @@ Options: -s, --storage # Use this folder for all test resources -e, --extensions_dir # VS Code will use this directory for managing extensions -t, --type # Type of VS Code release (stable/insider) + -p, --pre_release # Installs the pre-release version of the extension -h, --help # display help for command ``` diff --git a/packages/extester/src/cli.ts b/packages/extester/src/cli.ts index eed22285d..6c68ddff9 100644 --- a/packages/extester/src/cli.ts +++ b/packages/extester/src/cli.ts @@ -78,13 +78,14 @@ program .option('-s, --storage ', 'Use this folder for all test resources') .option('-e, --extensions_dir ', 'VS Code will use this directory for managing extensions') .option('-t, --type ', 'Type of VS Code release (stable/insider)') + .option('-p, --pre_release', 'Installs the pre-release version of the extension') .action( withErrors(async (id, ids, cmd) => { const extest = new ExTester(cmd.storage, codeStream(cmd.type), cmd.extensions_dir); - await extest.installFromMarketplace(id); + await extest.installFromMarketplace(id, cmd.pre_release); if (ids && ids.length > 0) { for (const idx of ids) { - await extest.installFromMarketplace(idx); + await extest.installFromMarketplace(idx, cmd.pre_release); } } }), diff --git a/packages/extester/src/extester.ts b/packages/extester/src/extester.ts index db2023371..588625543 100644 --- a/packages/extester/src/extester.ts +++ b/packages/extester/src/extester.ts @@ -127,8 +127,8 @@ export class ExTester { * Install an extension from VS Code marketplace into the test instance * @param id id of the extension to install */ - async installFromMarketplace(id: string): Promise { - return this.code.installExtension(undefined, id); + async installFromMarketplace(id: string, preRelease?: boolean): Promise { + return this.code.installExtension(undefined, id, preRelease); } /** diff --git a/packages/extester/src/util/codeUtil.ts b/packages/extester/src/util/codeUtil.ts index 4c1060cfb..149bc4d06 100644 --- a/packages/extester/src/util/codeUtil.ts +++ b/packages/extester/src/util/codeUtil.ts @@ -154,10 +154,10 @@ export class CodeUtil { /** * Install your extension into the test instance of VS Code */ - installExtension(vsix?: string, id?: string): void { + installExtension(vsix?: string, id?: string, preRelease?: boolean): void { const pjson = require(path.resolve('package.json')); if (id) { - return this.installExt(id); + return this.installExt(id, preRelease); } const vsixPath = path.resolve(vsix ? vsix : `${pjson.name}-${pjson.version}.vsix`); this.installExt(vsixPath); @@ -186,8 +186,11 @@ export class CodeUtil { } } - private installExt(pathOrID: string): void { + private installExt(pathOrID: string, preRelease?: boolean): void { let command = `${this.getCliInitCommand()} --force --install-extension "${pathOrID}"`; + if (preRelease) { + command += ' --pre-release'; + } if (this.extensionsFolder) { command += ` --extensions-dir=${this.extensionsFolder}`; }