Skip to content

feat: make production deploy test level configurable - #467

Open
Codeneos wants to merge 1 commit into
mainfrom
feature/production-deploy-test-level
Open

feat: make production deploy test level configurable#467
Codeneos wants to merge 1 commit into
mainfrom
feature/production-deploy-test-level

Conversation

@Codeneos

Copy link
Copy Markdown
Owner
  • Add vlocity.salesforce.productionDeployTestLevel with RunRelevantTests as the default production metadata deploy level.
  • Apply the configured test level only for production metadata deployments, preserving non-production no-test behavior.
  • Extend deploy option typing and cover production/non-production option selection with focused tests.

Validation:

  • pnpm build
  • pnpm jest packages/vscode-extension/src/commands/metadata/__tests__/deployMetadataCommand.test.ts -i --coverage=false
  • pnpm exec eslint packages/vscode-extension/src/commands/metadata/deployMetadataCommand.ts packages/vscode-extension/src/commands/metadata/__tests__/deployMetadataCommand.test.ts packages/vscode-extension/src/lib/vlocodeConfiguration.ts packages/salesforce/src/connection/metadata/types/deployResult.ts --no-error-on-unmatched-pattern
  • git diff --check

Copilot AI review requested due to automatic review settings July 16, 2026 20:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 027752add6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

protected async getDeploymentStartOptions(): Promise<DeployOptions> {
const options: DeployOptions = { ignoreWarnings: true };
if (await this.salesforce.isProductionOrg()) {
options.testLevel = this.vlocode.config.salesforce.productionDeployTestLevel ?? 'RunRelevantTests';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use a supported Metadata API test level

For production orgs that retain the new default, this sends RunRelevantTests directly to connection.metadata.deploy via SalesforceDeployment.start (packages/salesforce/src/salesforceDeployment.ts:176). That is not a Metadata API test-level value: the project's generated TestLevel definition permits only NoTestRun, RunSpecifiedTests, RunLocalTests, and RunAllTestsInOrg (packages/salesforce/src/types/metadata.ts:823). Consequently, every default production metadata deployment is rejected for an invalid testLevel; use a supported default such as RunLocalTests.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a VS Code configuration knob to control the Apex test execution level used during production Salesforce metadata deployments, while keeping non-production deploy behavior unchanged. It also extends deploy option typing in @vlocode/salesforce and adds focused unit tests around the option selection.

Changes:

  • Introduces vlocity.salesforce.productionDeployTestLevel and wires it into DeployMetadataCommand only for production org deployments.
  • Extends DeployOptions.testLevel typing and adds unit tests validating production vs non-production option shaping.
  • Updates extension configuration schema to expose the new setting.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/vscode-extension/src/lib/vlocodeConfiguration.ts Adds a typed config property for the production deploy test level.
packages/vscode-extension/src/commands/metadata/deployMetadataCommand.ts Applies the configured production-only deploy start options (including test level).
packages/vscode-extension/src/commands/metadata/tests/deployMetadataCommand.test.ts Adds unit coverage for production/non-production deploy option selection.
packages/vscode-extension/package.json Contributes the new VS Code setting (enum + default + descriptions).
packages/salesforce/src/connection/metadata/types/deployResult.ts Extends deploy option typing to include the new test level value.

* _Note: Apex tests that run as part of a deployment always run synchronously and serially._
*/
testLevel?: 'NoTestRun' | 'RunSpecifiedTests' | 'RunLocalTests' | 'RunAllTestsInOrg';
testLevel?: 'NoTestRun' | 'RunRelevantTests' | 'RunSpecifiedTests' | 'RunLocalTests' | 'RunAllTestsInOrg';
Comment on lines +211 to +217
protected async getDeploymentStartOptions(): Promise<DeployOptions> {
const options: DeployOptions = { ignoreWarnings: true };
if (await this.salesforce.isProductionOrg()) {
options.testLevel = this.vlocode.config.salesforce.productionDeployTestLevel ?? 'RunRelevantTests';
}
return options;
}
enabled: boolean;
deployOnSave: boolean;
apiVersion: string;
productionDeployTestLevel: 'RunRelevantTests' | 'RunLocalTests' | 'RunAllTestsInOrg';
Comment on lines +1516 to +1530
"vlocity.salesforce.productionDeployTestLevel": {
"type": "string",
"enum": [
"RunRelevantTests",
"RunLocalTests",
"RunAllTestsInOrg"
],
"default": "RunRelevantTests",
"enumDescriptions": [
"Run tests that Salesforce determines are relevant to the deployed metadata.",
"Run all local Apex tests in the production org.",
"Run all Apex tests in the production org, including managed package tests."
],
"markdownDescription": "Apex test level used for Salesforce metadata deployments to production orgs. `NoTestRun` is not available in production."
},
Comment on lines +5 to +7
public execute() {
return undefined;
}
Comment on lines +37 to +42
it('defaults production deployments to RunRelevantTests', async () => {
await expect(new TestDeployMetadataCommand(true).getOptions()).resolves.toEqual({
ignoreWarnings: true,
testLevel: 'RunRelevantTests'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants