Skip to content

Commit

Permalink
issue-726: Add support for installing dependencies in the extest inst…
Browse files Browse the repository at this point in the history
…all-vsix command (#808)

Signed-off-by: Dominik Jelinek <[email protected]>
  • Loading branch information
djelinek authored Oct 4, 2023
1 parent ceda3c4 commit 8f1a515
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ program.command('install-vsix')
.option('-f, --vsix_file <file>', 'path/URL to vsix file containing the extension')
.option('-y, --yarn', 'Use yarn to build the extension via vsce instead of npm', false)
.option('-t, --type <type>', 'Type of VSCode release (stable/insider)')
.option('-i, --install_dependencies', 'Automatically install extensions your extension depends on', false)
.action(withErrors(async (cmd) => {
const extest = new ExTester(cmd.storage, codeStream(cmd.type), cmd.extensions_dir);
await extest.installVsix({vsixFile: cmd.vsix_file, useYarn: cmd.yarn});
await extest.installVsix({vsixFile: cmd.vsix_file, useYarn: cmd.yarn, installDependencies: cmd.install_dependencies});
}));

program.command('install-from-marketplace <id> [ids...]')
Expand Down
7 changes: 5 additions & 2 deletions src/extester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ExTester {
* @param vsixFile path to extension .vsix file. If not set, default vsce path will be used
* @param useYarn when true run `vsce package` with the `--yarn` flag
*/
async installVsix({vsixFile, useYarn}: {vsixFile?: string, useYarn?: boolean} = {}): Promise<void> {
async installVsix({vsixFile, useYarn, installDependencies}: {vsixFile?: string, useYarn?: boolean, installDependencies?: boolean} = {}): Promise<void> {
let target = vsixFile;
if (vsixFile) {
try {
Expand All @@ -73,7 +73,10 @@ export class ExTester {
} else {
await this.code.packageExtension(useYarn);
}
return this.code.installExtension(target);
this.code.installExtension(target);
if (installDependencies) {
this.code.installDependencies();
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/util/codeUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class CodeUtil {
process.env.TEST_RESOURCES = this.downloadFolder;
process.env.EXTENSIONS_FOLDER = this.extensionsFolder;
const runner = new VSRunner(this.executablePath, literalVersion, this.parseSettings(runOptions.settings ?? DEFAULT_RUN_OPTIONS.settings), runOptions.cleanup, this.releaseType, runOptions.config);
return runner.runTests(testFilesPattern, this, runOptions.logLevel, runOptions.resources);
return await runner.runTests(testFilesPattern, this, runOptions.logLevel, runOptions.resources);
}

/**
Expand Down

0 comments on commit 8f1a515

Please sign in to comment.