@salesforce/salesforcedx-vscode-test-tools
Version:
Test automation framework for Salesforce Extensions for VS Code
91 lines (90 loc) • 4.06 kB
TypeScript
import { SpawnOptionsWithoutStdio } from 'child_process';
import { SfCommandRunResults, OrgEdition } from '../core';
export type NONE = 'NONE';
export interface SfCommandOptions extends SpawnOptionsWithoutStdio {
stdin?: string;
}
/**
* Runs a Salesforce CLI command with optional stdin input
* @param command - The SF CLI command to run
* @param args - Command arguments and options
* @returns Promise resolving to command results
*/
export declare function runCliCommand(command: string, ...args: (string | SfCommandOptions)[]): Promise<SfCommandRunResults>;
/**
* Deletes a scratch org by alias name
* @param orgAliasName - The alias of the scratch org to delete
*/
export declare function deleteScratchOrg(orgAliasName: string | undefined): Promise<void>;
/**
* Logs into an org using an SFDX auth URL file
* @param authFilePath - Path to the auth file containing the SFDX URL
* @returns Results of the login command
* @throws Error if login fails
*/
export declare function orgLoginSfdxUrl(): Promise<SfCommandRunResults>;
/**
* Displays information about a Salesforce org
* @param usernameOrAlias - Username or alias of the org to display
* @returns Results of the org display command
* @throws Error if the command fails
*/
export declare function orgDisplay(usernameOrAlias: string | undefined): Promise<SfCommandRunResults>;
/**
* Lists all Salesforce orgs
* @returns Results of the org list command
* @throws Error if the command fails
*/
export declare function orgList(): Promise<SfCommandRunResults>;
/**
* Lists all aliases
* @returns Results of the alias list command
* @throws Error if the command fails
*/
export declare function aliasList(): Promise<SfCommandRunResults>;
/**
* Creates a scratch org and makes it the project default
* @param edition - The org edition to use (developer or enterprise)
* @param definitionFileOrNone - Path to the scratch org definition file or 'NONE'
* @param scratchOrgAliasName - Alias to assign to the scratch org
* @param durationDays - Number of days before the scratch org expires
* @returns Results of the scratch org creation command
* @throws Error if scratch org creation fails
*/
export declare function scratchOrgCreate(edition: OrgEdition, definitionFileOrNone: string | NONE, scratchOrgAliasName: string, durationDays: number): Promise<SfCommandRunResults>;
/**
* Sets an alias for a Salesforce org username
* @param devHubAliasName - The alias to set
* @param devHubUserName - The username to associate with the alias
* @returns Results of the alias set command
* @throws Error if alias setting fails
*/
export declare function setAlias(devHubAliasName: string, devHubUserName: string): Promise<SfCommandRunResults>;
/**
* Installs Jest testing tools for LWC
* @param projectFolder - Path to the project folder
* @throws Error if installation fails or project folder is undefined
*/
export declare function installJestUTToolsForLwc(projectFolder: string | undefined): Promise<void>;
/**
* Creates a user in a Salesforce org
* @param systemAdminUserDefPath - Path to the user definition file
* @param targetOrg - The org where the user should be created
* @returns Results of the user creation command
* @throws Error if user creation fails or target org is undefined
*/
export declare function createUser(systemAdminUserDefPath: string, targetOrg: string | undefined): Promise<SfCommandRunResults>;
/**
* Removes escape characters from CLI command output
* @param result - The string to clean up
* @returns The string with escape characters removed
*/
export declare function removeEscapedCharacters(result: string): string;
/**
* Generates a Salesforce project
* @param name - The name of the project
* @param path - Optional path where the project should be created
* @param template - Optional template to use for project creation
* @returns Results of the project generation command
*/
export declare function generateSfProject(name: string, path?: string | undefined, template?: string | undefined): Promise<SfCommandRunResults>;