• Stub methods on the Ux class. Even if you plan to make no assertions, this will silence the output to keep your test results clean

    Parameters

    • sandbox: SinonSandbox

    Returns {
        info: SinonStub<[input: Info], void>;
        log: SinonStub<[message?: string, ...args: any[]], void>;
        logJson: SinonStub<[json: unknown], void>;
        logSensitive: SinonStub<[msg?: string], void>;
        logSuccess: SinonStub<[message: string], void>;
        logToStderr: SinonStub<[message?: string, ...args: any[]], void>;
        styledHeader: SinonStub<[text: string], void>;
        styledJSON: SinonStub<[obj: AnyJson], void>;
        styledObject: SinonStub<[obj: AnyJson], void>;
        table: SinonStub<[options: TableOptions<Record<string, unknown>>], void>;
        url: SinonStub<[text: string, uri: string, params: {}], void>;
        warn: SinonStub<[input: Warning], Warning>;
    }

    • info: SinonStub<[input: Info], void>
    • log: SinonStub<[message?: string, ...args: any[]], void>
    • logJson: SinonStub<[json: unknown], void>
    • logSensitive: SinonStub<[msg?: string], void>
    • logSuccess: SinonStub<[message: string], void>
    • logToStderr: SinonStub<[message?: string, ...args: any[]], void>
    • styledHeader: SinonStub<[text: string], void>
    • styledJSON: SinonStub<[obj: AnyJson], void>
    • styledObject: SinonStub<[obj: AnyJson], void>
    • table: SinonStub<[options: TableOptions<Record<string, unknown>>], void>
    • url: SinonStub<[text: string, uri: string, params: {}], void>
    • warn: SinonStub<[input: Warning], Warning>
    import { stubSfCommandUx } from '@salesforce/sf-plugins-core';
    let stubSfCommandUxStubs: ReturnType<typeof stubSfCommandUx>;

    // inside your beforeEach, $$ is a SinonSandbox
    cmdStubs = stubSfCommandUx($$.SANDBOX);

    // inside some test
    expect(cmdStubs.warn.args.flat()).to.deep.include(`foo`);