@salesforce/command
Version:
Salesforce CLI base command class
142 lines (141 loc) • 4.05 kB
TypeScript
import * as oclifTest from '@oclif/test';
import { command, Config, expect, FancyTypes } from '@oclif/test';
import { Config as OclifConfig } from '@oclif/core';
import { AuthFields } from '@salesforce/core';
import { TestContext } from '@salesforce/core/lib/testSetup';
import { AnyJson, Dictionary, JsonMap } from '@salesforce/ts-types';
import { loadConfig } from '@oclif/test/lib/load-config';
declare const $$: TestContext;
/**
* @deprecated We recommend unit tests test smaller units of code, not entire commands.
* For command-level tests, we recommend using NUTs (real-world tests, see https://github.com/salesforcecli/cli-plugins-testkit)
* If you have existing tests you want to maintain, import oclif/test directly and make use of TextContext from sfdx-core: https://github.com/forcedotcom/sfdx-core/tree/v3#using-testsetup
*
*/
declare const test: oclifTest.FancyTypes.Base<oclifTest.FancyTypes.Context, {
skip: {
output: unknown;
args: [];
};
} & {
only: {
output: unknown;
args: [];
};
} & {
retries: {
output: unknown;
args: [count: number];
};
} & {
catch: {
output: {
error: Error;
};
args: [arg: string | RegExp | ((err: Error) => any), opts?: {
raiseIfNotThrown?: boolean | undefined;
} | undefined];
};
} & {
env: {
output: unknown;
args: [env: {
[k: string]: string | null | undefined;
}, opts?: oclifTest.FancyTypes.EnvOptions | undefined];
};
} & {
stub: {
output: {
stubs: any[];
};
args: [object: any, path: any, value: () => any];
};
} & {
stdin: {
output: unknown;
args: [input: string, delay?: number | undefined];
};
} & {
stderr: {
output: {
readonly stderr: string;
};
args: [opts?: {
print?: boolean | undefined;
stripColor?: boolean | undefined;
} | undefined];
};
} & {
stdout: {
output: {
readonly stdout: string;
};
args: [opts?: {
print?: boolean | undefined;
stripColor?: boolean | undefined;
} | undefined];
};
} & {
nock: {
output: {
nock: number;
};
args: [host: string, options: oclifTest.FancyTypes.NockOptions | oclifTest.FancyTypes.NockCallback, cb?: oclifTest.FancyTypes.NockCallback | undefined];
};
} & {
timeout: {
output: {
timeout: number;
};
args: [timeout?: number | undefined];
};
} & {
loadConfig: {
output: {
config: import("@oclif/core/lib/interfaces").Config;
};
args: [opts?: loadConfig.Options | undefined];
};
} & {
command: {
output: {
config: import("@oclif/core/lib/interfaces").Config;
expectation: string;
returned: unknown;
};
args: [args: string | string[], opts?: loadConfig.Options | undefined];
};
} & {
exit: {
output: {
error: any;
};
args: [code?: number | undefined];
};
} & {
hook: {
output: {
config: import("@oclif/core/lib/interfaces").Config;
expectation: string;
returned: unknown;
};
args: [event: string, hookOpts?: Record<string, unknown> | undefined, options?: loadConfig.Options | undefined];
};
} & {
withOrg: {
output: Dictionary<unknown>;
args: [org?: Partial<AuthFields> | undefined, setAsDefault?: boolean | undefined];
};
} & {
withConnectionRequest: {
output: Dictionary<unknown>;
args: [fakeFunction: (request: AnyJson, options?: AnyJson) => Promise<AnyJson>];
};
} & {
withProject: {
output: unknown;
args: [SfProjectJson?: JsonMap | undefined];
};
}>;
export default test;
export { expect, FancyTypes, Config, command, loadConfig, OclifConfig, test, $$, TestContext };