Skip to content

Commit

Permalink
Merge pull request #812 from salesforcecli/sm/pr805
Browse files Browse the repository at this point in the history
Sm/pr805
  • Loading branch information
shetzel authored Nov 15, 2023
2 parents 6592654 + 5cc8ffa commit 54298a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add a new deploy command

The deploy-retrieve plugin does not have any commands for deploying or or retrieving specific pieces of a salesforce project (e.g. metadata to a scratch or functions to a compute environment). Instead, we ask developers to create their own plugin with those commands. In order for the `deploy` or `retrieve` commands to know about the individual plugins, each plugin must implement an [oclif hook](https://oclif.io/docs/hooks) which returns [`Deployers`](https://github.com/salesforcecli/plugin-deploy-retrieve-utils/blob/main/src/deployer.ts) and `Retirevers`.
The deploy-retrieve plugin does not have any commands for deploying or or retrieving specific pieces of a salesforce project (e.g. metadata to a scratch or functions to a compute environment). Instead, we ask developers to create their own plugin with those commands. In order for the `deploy` or `retrieve` commands to know about the individual plugins, each plugin must implement an [oclif hook](https://oclif.io/docs/hooks) which returns [`Deployers`](https://github.com/salesforcecli/plugin-deploy-retrieve-utils/blob/main/src/deployer.ts) and `Retrievers`.

This method allows developers to own their own plugins while also allowing a simple way for the overarching `project` topic to interact with those plugins.

Expand Down
2 changes: 1 addition & 1 deletion src/utils/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const ensuredDirFlag = Flags.custom<string>({
export const testLevelFlag = Flags.custom<TestLevel>({
char: 'l',
parse: (input) => Promise.resolve(input as TestLevel),
default: async (context) => Promise.resolve(context.flags.tests ? TestLevel.RunSpecifiedTests : undefined),
options: Object.values(TestLevel),
});

Expand All @@ -92,7 +93,6 @@ export const zipFileFlag = Flags.custom<string>({
export const testsFlag = Flags.custom({
char: 't',
multiple: true,
dependsOn: ['test-level'],
summary: commonFlagMessages.getMessage('flags.tests.summary'),
description: commonFlagMessages.getMessage('flags.tests.description'),
// the old version allowed comma separated values, and the change is confusing enough to deserve a warning
Expand Down
9 changes: 9 additions & 0 deletions test/nuts/seeds/deploy.metadata.test-level.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ context('deploy metadata --test-level NUTs [name: %REPO_NAME%]', () => {
});
await testkit.expect.specificApexTestsToBeRun(REPO.deploy.testLevel.specifiedTests);
});

it('should set --test-level flag to (RunSpecifiedTests) if --tests flag is included', async () => {
const packages = testkit.packageNames.map((p) => `--source-dir ${p}`).join(' ');
const tests = REPO.deploy.testLevel.specifiedTests.join(',');
await testkit.deploy({
args: `${packages} --tests ${tests} --ignore-errors`,
});
await testkit.expect.specificApexTestsToBeRun(REPO.deploy.testLevel.specifiedTests);
});
});

describe('test result format', () => {
Expand Down

0 comments on commit 54298a4

Please sign in to comment.