-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export Spinner and remove console.error (#223)
* feat: export Spinner and remove console.error * feat: add stubUx * fix: use logJson * chore: test fixes * fix: add prompter stubs * chore: remove ts-types for external nuts * chore: revert changelog * chore: fix logJson
- Loading branch information
1 parent
aa71ec7
commit 04475a0
Showing
7 changed files
with
609 additions
and
494 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2023, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
import { SinonSandbox } from 'sinon'; | ||
import { SfCommand } from './sfCommand'; | ||
import { Prompter, Spinner, Ux } from './ux'; | ||
|
||
export function stubUx(sandbox: SinonSandbox) { | ||
return { | ||
log: sandbox.stub(Ux.prototype, 'log'), | ||
warn: sandbox.stub(Ux.prototype, 'warn'), | ||
table: sandbox.stub(Ux.prototype, 'table'), | ||
url: sandbox.stub(Ux.prototype, 'url'), | ||
styledHeader: sandbox.stub(Ux.prototype, 'styledHeader'), | ||
styledObject: sandbox.stub(Ux.prototype, 'styledObject'), | ||
styledJSON: sandbox.stub(Ux.prototype, 'styledJSON'), | ||
}; | ||
} | ||
|
||
export function stubSfCommandUx(sandbox: SinonSandbox) { | ||
return { | ||
log: sandbox.stub(SfCommand.prototype, 'log'), | ||
logToStderr: sandbox.stub(SfCommand.prototype, 'logToStderr'), | ||
logSuccess: sandbox.stub(SfCommand.prototype, 'logSuccess'), | ||
logSensitive: sandbox.stub(SfCommand.prototype, 'logSensitive'), | ||
info: sandbox.stub(SfCommand.prototype, 'info'), | ||
warn: sandbox.stub(SfCommand.prototype, 'warn'), | ||
table: sandbox.stub(SfCommand.prototype, 'table'), | ||
url: sandbox.stub(SfCommand.prototype, 'url'), | ||
styledHeader: sandbox.stub(SfCommand.prototype, 'styledHeader'), | ||
styledObject: sandbox.stub(SfCommand.prototype, 'styledObject'), | ||
styledJSON: sandbox.stub(SfCommand.prototype, 'styledJSON'), | ||
}; | ||
} | ||
|
||
export function stubSpinner(sandbox: SinonSandbox) { | ||
return { | ||
start: sandbox.stub(Spinner.prototype, 'start'), | ||
stop: sandbox.stub(Spinner.prototype, 'stop'), | ||
}; | ||
} | ||
|
||
export function stubPrompter(sandbox: SinonSandbox) { | ||
return { | ||
prompt: sandbox.stub(Prompter.prototype, 'prompt'), | ||
confirm: sandbox.stub(Prompter.prototype, 'confirm'), | ||
timedPrompt: sandbox.stub(Prompter.prototype, 'timedPrompt'), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.