UNPKG

4.05 kBTypeScriptView Raw
1import * as oclifTest from '@oclif/test';
2import { command, Config, expect, FancyTypes } from '@oclif/test';
3import { Config as OclifConfig } from '@oclif/core';
4import { AuthFields } from '@salesforce/core';
5import { TestContext } from '@salesforce/core/lib/testSetup';
6import { AnyJson, Dictionary, JsonMap } from '@salesforce/ts-types';
7import { loadConfig } from '@oclif/test/lib/load-config';
8declare const $$: TestContext;
9/**
10 * @deprecated We recommend unit tests test smaller units of code, not entire commands.
11 * For command-level tests, we recommend using NUTs (real-world tests, see https://github.com/salesforcecli/cli-plugins-testkit)
12 * 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
13 *
14 */
15declare const test: oclifTest.FancyTypes.Base<oclifTest.FancyTypes.Context, {
16 skip: {
17 output: unknown;
18 args: [];
19 };
20} & {
21 only: {
22 output: unknown;
23 args: [];
24 };
25} & {
26 retries: {
27 output: unknown;
28 args: [count: number];
29 };
30} & {
31 catch: {
32 output: {
33 error: Error;
34 };
35 args: [arg: string | RegExp | ((err: Error) => any), opts?: {
36 raiseIfNotThrown?: boolean | undefined;
37 } | undefined];
38 };
39} & {
40 env: {
41 output: unknown;
42 args: [env: {
43 [k: string]: string | null | undefined;
44 }, opts?: oclifTest.FancyTypes.EnvOptions | undefined];
45 };
46} & {
47 stub: {
48 output: {
49 stubs: any[];
50 };
51 args: [object: any, path: any, value: () => any];
52 };
53} & {
54 stdin: {
55 output: unknown;
56 args: [input: string, delay?: number | undefined];
57 };
58} & {
59 stderr: {
60 output: {
61 readonly stderr: string;
62 };
63 args: [opts?: {
64 print?: boolean | undefined;
65 stripColor?: boolean | undefined;
66 } | undefined];
67 };
68} & {
69 stdout: {
70 output: {
71 readonly stdout: string;
72 };
73 args: [opts?: {
74 print?: boolean | undefined;
75 stripColor?: boolean | undefined;
76 } | undefined];
77 };
78} & {
79 nock: {
80 output: {
81 nock: number;
82 };
83 args: [host: string, options: oclifTest.FancyTypes.NockOptions | oclifTest.FancyTypes.NockCallback, cb?: oclifTest.FancyTypes.NockCallback | undefined];
84 };
85} & {
86 timeout: {
87 output: {
88 timeout: number;
89 };
90 args: [timeout?: number | undefined];
91 };
92} & {
93 loadConfig: {
94 output: {
95 config: import("@oclif/core/lib/interfaces").Config;
96 };
97 args: [opts?: loadConfig.Options | undefined];
98 };
99} & {
100 command: {
101 output: {
102 config: import("@oclif/core/lib/interfaces").Config;
103 expectation: string;
104 returned: unknown;
105 };
106 args: [args: string | string[], opts?: loadConfig.Options | undefined];
107 };
108} & {
109 exit: {
110 output: {
111 error: any;
112 };
113 args: [code?: number | undefined];
114 };
115} & {
116 hook: {
117 output: {
118 config: import("@oclif/core/lib/interfaces").Config;
119 expectation: string;
120 returned: unknown;
121 };
122 args: [event: string, hookOpts?: Record<string, unknown> | undefined, options?: loadConfig.Options | undefined];
123 };
124} & {
125 withOrg: {
126 output: Dictionary<unknown>;
127 args: [org?: Partial<AuthFields> | undefined, setAsDefault?: boolean | undefined];
128 };
129} & {
130 withConnectionRequest: {
131 output: Dictionary<unknown>;
132 args: [fakeFunction: (request: AnyJson, options?: AnyJson) => Promise<AnyJson>];
133 };
134} & {
135 withProject: {
136 output: unknown;
137 args: [SfProjectJson?: JsonMap | undefined];
138 };
139}>;
140export default test;
141export { expect, FancyTypes, Config, command, loadConfig, OclifConfig, test, $$, TestContext };