Skip to content

Commit e8fbfd5

Browse files
srtaalejzimeg
andauthored
fix(cli-test)!: remove default "--app deployed" global flag from commands (#2624)
Co-authored-by: Eden Zimbelman <eden.zimbelman@salesforce.com>
1 parent b06909d commit e8fbfd5

3 files changed

Lines changed: 29 additions & 9 deletions

File tree

.changeset/silver-papers-lick.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
"@slack/cli-test": major
3+
---
4+
5+
fix: remove default "--app deployed" global flag from commands
6+
7+
Commands running for a specific app must now provide the "app" argument:
8+
9+
```diff
10+
await SlackCLI.app.delete({
11+
appPath: "my-app",
12+
team: "T0123456789",
13+
+ app: "deployed",
14+
});
15+
```
16+
17+
The options "local" or "deployed" or app ID all remain available to use.

packages/cli-test/src/cli/cli-process.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,22 @@ describe('SlackCLIProcess class', () => {
9898
await cmd.execAsync();
9999
sandbox.assert.calledWith(spawnProcessSpy, sinon.match.string, sinon.match.array.contains(['--skip-update']));
100100
});
101-
it('should default to `--app deployed` but allow overriding that via the `app` parameter', async () => {
101+
it('should only pass `--app` when explicitly provided via the `app` parameter', async () => {
102102
let cmd = new SlackCLIProcess(['help']);
103103
await cmd.execAsync();
104+
sandbox.assert.neverCalledWith(spawnProcessSpy, sinon.match.string, sinon.match.array.contains(['--app']));
105+
spawnProcessSpy.resetHistory();
106+
cmd = new SlackCLIProcess(['help'], { app: 'local' });
107+
await cmd.execAsync();
108+
sandbox.assert.calledWith(spawnProcessSpy, sinon.match.string, sinon.match.array.contains(['--app', 'local']));
109+
spawnProcessSpy.resetHistory();
110+
cmd = new SlackCLIProcess(['help'], { app: 'deployed' });
111+
await cmd.execAsync();
104112
sandbox.assert.calledWith(
105113
spawnProcessSpy,
106114
sinon.match.string,
107115
sinon.match.array.contains(['--app', 'deployed']),
108116
);
109-
spawnProcessSpy.resetHistory();
110-
cmd = new SlackCLIProcess(['help'], { app: 'local' });
111-
await cmd.execAsync();
112-
sandbox.assert.calledWith(spawnProcessSpy, sinon.match.string, sinon.match.array.contains(['--app', 'local']));
113117
});
114118
it('should default to `--force` but allow overriding that via the `force` parameter', async () => {
115119
let cmd = new SlackCLIProcess(['help']);

packages/cli-test/src/cli/cli-process.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,9 @@ export class SlackCLIProcess {
131131
if (opts.team) {
132132
cmd = cmd.concat(['--team', opts.team]);
133133
}
134-
// App instance; defaults to `deployed`
134+
// App instance
135135
if (opts.app) {
136136
cmd = cmd.concat(['--app', opts.app]);
137-
} else {
138-
cmd = cmd.concat(['--app', 'deployed']);
139137
}
140138
// Ignore warnings via --force; defaults to true
141139
if (opts.force || typeof opts.force === 'undefined') {
@@ -149,9 +147,10 @@ export class SlackCLIProcess {
149147
cmd = cmd.concat(['--verbose']);
150148
}
151149
} else {
152-
cmd = cmd.concat(['--skip-update', '--force', '--app', 'deployed']);
150+
cmd = cmd.concat(['--skip-update', '--force']);
153151
}
154152
cmd = cmd.concat(this.command);
153+
155154
if (this.commandOptions) {
156155
for (const [key, value] of Object.entries(this.commandOptions)) {
157156
if (key && value) {

0 commit comments

Comments
 (0)