Skip to content

Commit 0c54144

Browse files
Merge pull request #591 from salesforcecli/phale/W-12587837
fix: license-type should not be needed when cloning a sandbox
2 parents 2519710 + 94a9ced commit 0c54144

File tree

6 files changed

+874
-815
lines changed

6 files changed

+874
-815
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"tslib": "^2"
1515
},
1616
"devDependencies": {
17-
"@oclif/plugin-command-snapshot": "^3.3.4",
17+
"@oclif/plugin-command-snapshot": "^3.3.6",
1818
"@salesforce/cli-plugins-testkit": "^3.2.23",
1919
"@salesforce/dev-config": "^3.1.0",
2020
"@salesforce/dev-scripts": "^4.1.1",
@@ -115,7 +115,7 @@
115115
"prepack": "sf-prepack",
116116
"prepare": "sf-install",
117117
"test": "wireit",
118-
"test:nuts": "nyc mocha \"./test/nut/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --jobs 10",
118+
"test:nuts": "nyc mocha \"./test/nut/*.nut.ts\" --slow 4500 --timeout 1200000",
119119
"test:nuts:legacy": "nyc mocha \"./test/nut/legacy/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --jobs 10",
120120
"test:nuts:sandbox": "nyc mocha \"./test/**/*.sandboxNut.ts\" --slow 450000 --timeout 7200000 --parallel --jobs 10",
121121
"test:only": "wireit",

src/commands/org/create/sandbox.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,14 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxProcessObje
136136

137137
private async createSandboxRequest(): Promise<SandboxRequest> {
138138
// reuse the existing sandbox request generator, with this command's flags as the varargs
139-
const { sandboxReq } = await createSandboxRequest(false, this.flags['definition-file'], undefined, {
139+
const requestOptions = {
140140
...(this.flags.name ? { SandboxName: this.flags.name } : {}),
141+
...(this.flags.clone ? { SourceSandboxName: this.flags.clone } : {}),
141142
...(!this.flags.clone && this.flags['license-type'] ? { LicenseType: this.flags['license-type'] } : {}),
142-
});
143+
};
144+
const { sandboxReq } = !this.flags.clone
145+
? await createSandboxRequest(false, this.flags['definition-file'], undefined, requestOptions)
146+
: await createSandboxRequest(true, this.flags['definition-file'], undefined, requestOptions);
143147
return {
144148
...sandboxReq,
145149
...(this.flags.clone ? { SourceId: await this.getSourceId() } : {}),

src/commands/org/list.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export class OrgListCommand extends SfCommand<OrgListResult> {
5151

5252
private flags!: Interfaces.InferredFlags<typeof OrgListCommand.flags>;
5353

54-
// eslint-disable-next-line sf-plugin/should-parse-flags
5554
public async run(): Promise<OrgListResult> {
5655
const [{ flags }, fileNames] = await Promise.all([this.parse(OrgListCommand), getAuthFileNames()]);
5756
this.flags = flags;

src/commands/org/resume/scratch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default class EnvResumeScratch extends SfCommand<ScratchCreateResponse> {
3030
public static readonly flags = {
3131
'job-id': Flags.salesforceId({
3232
char: 'i',
33+
length: 'both',
3334
summary: messages.getMessage('flags.job-id.summary'),
3435
description: messages.getMessage('flags.job-id.description'),
3536
exactlyOne: ['use-most-recent', 'job-id'],

test/nut/listAndDisplay.nut.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
import { join } from 'path';
9+
import * as os from 'os';
910
import { expect, config, assert } from 'chai';
1011
import { TestSession } from '@salesforce/cli-plugins-testkit';
1112
import { execCmd } from '@salesforce/cli-plugins-testkit';
@@ -91,7 +92,7 @@ describe('Org Command NUT', () => {
9192

9293
describe('List Orgs', () => {
9394
it('should list all orgs', () => {
94-
const listResult = execCmd<OrgListResult>('force:org:list --json', { ensureExitCode: 0 }).jsonOutput?.result;
95+
const listResult = execCmd<OrgListResult>('org:list --json', { ensureExitCode: 0 }).jsonOutput?.result;
9596
assert(listResult);
9697
expect(listResult).to.have.property('nonScratchOrgs');
9798
expect(listResult.nonScratchOrgs).to.have.length(1);
@@ -121,8 +122,8 @@ describe('Org Command NUT', () => {
121122
JSON.stringify(listResult.nonScratchOrgs[0])
122123
);
123124
});
124-
it('should list orgs - skipconnectionstatus', () => {
125-
const listResult = execCmd<OrgListResult>('force:org:list --skipconnectionstatus --json', { ensureExitCode: 0 })
125+
it('should list orgs - skip-connection-status', () => {
126+
const listResult = execCmd<OrgListResult>('org:list --skip-connection-status --json', { ensureExitCode: 0 })
126127
.jsonOutput?.result;
127128
assert(listResult);
128129
const nonScratchOrgs = listResult.nonScratchOrgs[0];
@@ -136,25 +137,25 @@ describe('Org Command NUT', () => {
136137
);
137138
});
138139
it('should list orgs in a human readable form', () => {
139-
const lines = execCmd('force:org:list', { ensureExitCode: 0 }).shellOutput.stdout.split('\n');
140+
const lines = execCmd('org:list', { ensureExitCode: 0 }).shellOutput.stdout.split(os.EOL);
140141
verifyHumanResults(lines, defaultUsername, aliasedUsername);
141142
});
142143
it('should list additional information with --verbose', () => {
143-
const lines = execCmd('force:org:list --verbose', { ensureExitCode: 0 }).shellOutput.stdout.split('\n');
144+
const lines = execCmd('org:list --verbose', { ensureExitCode: 0 }).shellOutput.stdout.split(os.EOL);
144145
verifyHumanResults(lines, defaultUsername, aliasedUsername, true);
145146
});
146147
});
147148
describe('Org Display', () => {
148149
it('should display org information for default username', () => {
149-
const result = execCmd<OrgListResult>('force:org:display --json', { ensureExitCode: 0 }).jsonOutput?.result;
150+
const result = execCmd<OrgListResult>('org:display --json', { ensureExitCode: 0 }).jsonOutput?.result;
150151
expect(result).to.be.ok;
151152
expect(result).to.include({
152153
devHubId: hubOrgUsername,
153154
username: defaultUsername,
154155
});
155156
});
156157
it('should display scratch org information for alias', () => {
157-
const result = execCmd<OrgListResult>(`force:org:display -u ${aliasedUsername} --json`, { ensureExitCode: 0 })
158+
const result = execCmd<OrgListResult>(`org:display -u ${aliasedUsername} --json`, { ensureExitCode: 0 })
158159
.jsonOutput?.result;
159160
expect(result).to.be.ok;
160161
expect(result).to.include({
@@ -163,16 +164,16 @@ describe('Org Command NUT', () => {
163164
});
164165
});
165166
it('should display human readable org information for default username', () => {
166-
const lines = execCmd<OrgDisplayReturn>('force:org:display', { ensureExitCode: 0 }).shellOutput.stdout.split(
167-
'\n'
168-
);
167+
const result = execCmd<OrgDisplayReturn>('org:display', { ensureExitCode: 0 }).shellOutput;
168+
const stdout = result.stdout;
169+
const lines = stdout.split(os.EOL);
169170
expect(lines.length).to.have.greaterThan(0);
170171
const usernameLine = lines.find((line) => line.includes('Username'));
171172
expect(usernameLine).to.include(defaultUsername);
172173
});
173174
it('should display human readable scratch org information for alias', () => {
174-
const lines = execCmd(`force:org:display -u ${aliasedUsername}`, { ensureExitCode: 0 }).shellOutput.stdout.split(
175-
'\n'
175+
const lines = execCmd(`force:org:display -o ${aliasedUsername}`, { ensureExitCode: 0 }).shellOutput.stdout.split(
176+
os.EOL
176177
);
177178
expect(lines.length).to.have.greaterThan(0);
178179
const usernameLine = lines.find((line) => line.includes('Username'));
@@ -181,15 +182,15 @@ describe('Org Command NUT', () => {
181182
});
182183
describe('Org Open', () => {
183184
it('should produce the URL for an org in json', () => {
184-
const result = execCmd<OrgOpenOutput>(`force:org:open -u ${defaultUsername} --urlonly --json`, {
185+
const result = execCmd<OrgOpenOutput>(`org:open -o ${defaultUsername} --url-only --json`, {
185186
ensureExitCode: 0,
186187
}).jsonOutput?.result;
187188
expect(result).to.be.ok;
188189
expect(result).to.include({ orgId: defaultUserOrgId, username: defaultUsername });
189190
});
190191
it('should produce the URL with given path for an org in json', () => {
191192
const result = execCmd<OrgOpenOutput>(
192-
`force:org:open -u ${aliasedUsername} --urlonly --path "foo/bar/baz" --json`,
193+
`force:org:open -o ${aliasedUsername} --urlonly --path "foo/bar/baz" --json`,
193194
{
194195
ensureExitCode: 0,
195196
}

0 commit comments

Comments
 (0)