@sanity/cli-test 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -4
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mocks/cli-core/SanityCommand.d.ts +50 -0
- package/dist/mocks/cli-core/SanityCommand.js +75 -0
- package/dist/mocks/cli-core/SanityCommand.js.map +1 -0
- package/dist/mocks/cli-core/apiClient.d.ts +9 -0
- package/dist/mocks/cli-core/apiClient.js +5 -0
- package/dist/mocks/cli-core/apiClient.js.map +1 -0
- package/dist/mocks/cli-core/browser.d.ts +6 -0
- package/dist/mocks/cli-core/browser.js +4 -0
- package/dist/mocks/cli-core/browser.js.map +1 -0
- package/dist/mocks/cli-core/config.d.ts +66 -0
- package/dist/mocks/cli-core/config.js +30 -0
- package/dist/mocks/cli-core/config.js.map +1 -0
- package/dist/mocks/cli-core/package-manager.d.ts +30 -0
- package/dist/mocks/cli-core/package-manager.js +12 -0
- package/dist/mocks/cli-core/package-manager.js.map +1 -0
- package/dist/mocks/cli-core/request.d.ts +42 -0
- package/dist/mocks/cli-core/request.js +40 -0
- package/dist/mocks/cli-core/request.js.map +1 -0
- package/dist/mocks/cli-core/tasks.d.ts +12 -0
- package/dist/mocks/cli-core/tasks.js +6 -0
- package/dist/mocks/cli-core/tasks.js.map +1 -0
- package/dist/mocks/cli-core/telemetry.d.ts +31 -0
- package/dist/mocks/cli-core/telemetry.js +22 -0
- package/dist/mocks/cli-core/telemetry.js.map +1 -0
- package/dist/mocks/cli-core/ux.d.ts +77 -0
- package/dist/mocks/cli-core/ux.js +56 -0
- package/dist/mocks/cli-core/ux.js.map +1 -0
- package/dist/test/captureOutput.js +1 -1
- package/dist/test/captureOutput.js.map +1 -1
- package/dist/test/createMockSpinner.js +1 -0
- package/dist/test/createMockSpinner.js.map +1 -1
- package/dist/test/createTestClient.d.ts +57 -0
- package/dist/test/mockApi.d.ts +56 -0
- package/dist/test/mockSanityCommand.js.map +1 -1
- package/dist/test/mockTelemetry.js.map +1 -1
- package/dist/test/oclif.d.ts +179 -0
- package/dist/test/oclif.js +7 -0
- package/dist/test/oclif.js.map +1 -0
- package/dist/test/setupFixtures.d.ts +90 -0
- package/dist/test/setupFixtures.js +8 -10
- package/dist/test/setupFixtures.js.map +1 -1
- package/dist/test/util.d.ts +203 -0
- package/dist/test/util.js +11 -0
- package/dist/test/util.js.map +1 -0
- package/dist/utils/paths.d.ts +65 -0
- package/package.json +63 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CliConfig } from "@sanity/cli-core";
|
|
1
|
+
import { CliConfig } from "@sanity/cli-core/types";
|
|
2
2
|
import { ClientConfig } from "@sanity/client";
|
|
3
|
-
import { CLITelemetryStore } from "@sanity/cli-core";
|
|
3
|
+
import { CLITelemetryStore } from "@sanity/cli-core/types";
|
|
4
4
|
import { Command } from "@oclif/core";
|
|
5
5
|
import { Config } from "@oclif/core";
|
|
6
6
|
import { Errors } from "@oclif/core";
|
|
@@ -8,13 +8,14 @@ import { Hook } from "@oclif/core/hooks";
|
|
|
8
8
|
import { Hooks } from "@oclif/core/hooks";
|
|
9
9
|
import { Mock } from "vitest";
|
|
10
10
|
import nock from "nock";
|
|
11
|
-
import { ProjectRootResult } from "@sanity/cli-core";
|
|
11
|
+
import { ProjectRootResult } from "@sanity/cli-core/types";
|
|
12
12
|
import { SanityClient } from "@sanity/client";
|
|
13
|
-
import { SanityCommand } from "@sanity/cli-core";
|
|
13
|
+
import { SanityCommand } from "@sanity/cli-core/SanityCommand";
|
|
14
14
|
import { SpinnerInstance } from "@sanity/cli-core/ux";
|
|
15
15
|
import { TestProject } from "vitest/node";
|
|
16
16
|
import { vi } from "vitest";
|
|
17
17
|
|
|
18
|
+
/** @public */
|
|
18
19
|
declare interface CaptureOptions {
|
|
19
20
|
/**
|
|
20
21
|
* Whether to print the output to the console
|
|
@@ -27,6 +28,7 @@ declare interface CaptureOptions {
|
|
|
27
28
|
testNodeEnv?: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
/** @public */
|
|
30
32
|
declare interface CaptureResult<T = unknown> {
|
|
31
33
|
stderr: string;
|
|
32
34
|
stdout: string;
|
|
@@ -65,6 +67,7 @@ export declare function createMockHttpServer(): {
|
|
|
65
67
|
* Creates a mock spinner function to avoid writing output to stdout.
|
|
66
68
|
* @param overrides - Pass any mocks or stubs for test expectations
|
|
67
69
|
* @internal
|
|
70
|
+
* @deprecated Use mocks/cli-core/ux/spinner instead
|
|
68
71
|
*/
|
|
69
72
|
export declare function createMockSpinner(
|
|
70
73
|
overrides?: Partial<SpinnerInstance>,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
// DO NOT ADD NEW EXPORTS HERE!
|
|
2
|
+
// Instead, add them to the relevant granular export files laid out in package.json exports.
|
|
1
3
|
export * from './test/constants.js';
|
|
2
4
|
export * from './test/createMockHttpServer.js';
|
|
3
|
-
export { createMockSpinner } from './test/createMockSpinner.js';
|
|
4
5
|
export * from './test/createMockWatcher.js';
|
|
5
6
|
export * from './test/createTestClient.js';
|
|
6
7
|
export * from './test/createTestToken.js';
|
|
@@ -12,5 +13,6 @@ export * from './test/testCommand.js';
|
|
|
12
13
|
export * from './test/testFixture.js';
|
|
13
14
|
export * from './test/testHook.js';
|
|
14
15
|
export * from './utils/paths.js';
|
|
16
|
+
/** DEPRECATED */ export { createMockSpinner } from './test/createMockSpinner.js';
|
|
15
17
|
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// DO NOT ADD NEW EXPORTS HERE!\n// Instead, add them to the relevant granular export files laid out in package.json exports.\nexport * from './test/constants.js'\nexport * from './test/createMockHttpServer.js'\nexport * from './test/createMockWatcher.js'\nexport * from './test/createTestClient.js'\nexport * from './test/createTestToken.js'\nexport * from './test/mockApi.js'\nexport * from './test/mockSanityCommand.js'\nexport * from './test/mockTelemetry.js'\nexport * from './test/setupFixtures.js'\nexport * from './test/testCommand.js'\nexport * from './test/testFixture.js'\nexport * from './test/testHook.js'\nexport * from './utils/paths.js'\n\n/** DEPRECATED */\nexport {createMockSpinner} from './test/createMockSpinner.js'\n"],"names":["createMockSpinner"],"mappings":"AAAA,+BAA+B;AAC/B,4FAA4F;AAC5F,cAAc,sBAAqB;AACnC,cAAc,iCAAgC;AAC9C,cAAc,8BAA6B;AAC3C,cAAc,6BAA4B;AAC1C,cAAc,4BAA2B;AACzC,cAAc,oBAAmB;AACjC,cAAc,8BAA6B;AAC3C,cAAc,0BAAyB;AACvC,cAAc,0BAAyB;AACvC,cAAc,wBAAuB;AACrC,cAAc,wBAAuB;AACrC,cAAc,qBAAoB;AAClC,cAAc,mBAAkB;AAEhC,eAAe,GACf,SAAQA,iBAAiB,QAAO,8BAA6B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import { Mock } from "vitest";
|
|
3
|
+
import { Output } from "@sanity/cli-core/types";
|
|
4
|
+
import { ProjectRootResult } from "@sanity/cli-core/types";
|
|
5
|
+
import { SanityCommandInterface } from "@sanity/cli-core/types";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function createMockOutput(): Output;
|
|
11
|
+
|
|
12
|
+
declare interface MockCollection {
|
|
13
|
+
DefaultProjectRoot: ProjectRootResult;
|
|
14
|
+
OclifCmdExit: Mock<Command["exit"]>;
|
|
15
|
+
SanityCmdGetCliConfig: Mock;
|
|
16
|
+
SanityCmdGetProjectId: Mock;
|
|
17
|
+
SanityCmdGetProjectRoot: Mock<() => ProjectRootResult>;
|
|
18
|
+
SanityCmdIsUnattended: Mock;
|
|
19
|
+
SanityCmdOutput: Output;
|
|
20
|
+
SanityCmdResolveIsInteractive: Mock;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare const mocks: MockCollection;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A mocked SanityCommand, for use in mocking out the `@sanity/cli-core/SanityCommand` module's command class.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare class SanityCommand
|
|
33
|
+
extends Command
|
|
34
|
+
implements SanityCommandInterface
|
|
35
|
+
{
|
|
36
|
+
args: {};
|
|
37
|
+
flags: {};
|
|
38
|
+
output: Output;
|
|
39
|
+
exit(code?: number): never;
|
|
40
|
+
getCliConfig(): Promise<any>;
|
|
41
|
+
getProjectId(opts?: Record<string, any>): Promise<any>;
|
|
42
|
+
getProjectRoot(): Promise<ProjectRootResult>;
|
|
43
|
+
init(): Promise<void>;
|
|
44
|
+
isUnattended(): any;
|
|
45
|
+
resolveIsInteractive(): any;
|
|
46
|
+
run(): Promise<void>;
|
|
47
|
+
tryGetCliConfig(): Promise<any>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
const DefaultProjectRoot = {
|
|
4
|
+
directory: '/some/path/to/cli-test/mocks',
|
|
5
|
+
path: '/some/path/to/cli-test/mocks/sanity.studio.ts',
|
|
6
|
+
type: 'studio'
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/ export const mocks = {
|
|
11
|
+
DefaultProjectRoot,
|
|
12
|
+
// Mock OCLIF Command methods
|
|
13
|
+
OclifCmdExit: vi.fn((_code)=>undefined),
|
|
14
|
+
// Mock SanityCommand methods
|
|
15
|
+
SanityCmdGetCliConfig: vi.fn(),
|
|
16
|
+
SanityCmdGetProjectId: vi.fn(()=>'cli-test-mock-project-id'),
|
|
17
|
+
SanityCmdGetProjectRoot: vi.fn(()=>DefaultProjectRoot),
|
|
18
|
+
SanityCmdIsUnattended: vi.fn(),
|
|
19
|
+
SanityCmdOutput: createMockOutput(),
|
|
20
|
+
SanityCmdResolveIsInteractive: vi.fn()
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/ export function createMockOutput() {
|
|
25
|
+
return {
|
|
26
|
+
error: vi.fn(()=>undefined),
|
|
27
|
+
log: vi.fn(),
|
|
28
|
+
warn: vi.fn()
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A mocked SanityCommand, for use in mocking out the `@sanity/cli-core/SanityCommand` module's command class.
|
|
33
|
+
* @internal
|
|
34
|
+
*/ export class SanityCommand extends Command {
|
|
35
|
+
args = {};
|
|
36
|
+
flags = {};
|
|
37
|
+
output = mocks.SanityCmdOutput;
|
|
38
|
+
exit(code) {
|
|
39
|
+
return mocks.OclifCmdExit(code);
|
|
40
|
+
}
|
|
41
|
+
async getCliConfig() {
|
|
42
|
+
return mocks.SanityCmdGetCliConfig();
|
|
43
|
+
}
|
|
44
|
+
async getProjectId(opts) {
|
|
45
|
+
return mocks.SanityCmdGetProjectId(opts);
|
|
46
|
+
}
|
|
47
|
+
async getProjectRoot() {
|
|
48
|
+
return mocks.SanityCmdGetProjectRoot();
|
|
49
|
+
}
|
|
50
|
+
// Same implementation as SanityCommand's, minus telemetry
|
|
51
|
+
async init() {
|
|
52
|
+
const { args, flags } = await this.parse({
|
|
53
|
+
args: this.ctor.args,
|
|
54
|
+
baseFlags: super.ctor.baseFlags,
|
|
55
|
+
enableJsonFlag: this.ctor.enableJsonFlag,
|
|
56
|
+
flags: this.ctor.flags,
|
|
57
|
+
strict: this.ctor.strict
|
|
58
|
+
});
|
|
59
|
+
this.args = args;
|
|
60
|
+
this.flags = flags;
|
|
61
|
+
await super.init();
|
|
62
|
+
}
|
|
63
|
+
isUnattended() {
|
|
64
|
+
return mocks.SanityCmdIsUnattended();
|
|
65
|
+
}
|
|
66
|
+
resolveIsInteractive() {
|
|
67
|
+
return mocks.SanityCmdResolveIsInteractive();
|
|
68
|
+
}
|
|
69
|
+
async run() {}
|
|
70
|
+
async tryGetCliConfig() {
|
|
71
|
+
return this.getCliConfig();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=SanityCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mocks/cli-core/SanityCommand.ts"],"sourcesContent":["import {Command} from '@oclif/core'\nimport {type Output, ProjectRootResult, type SanityCommandInterface} from '@sanity/cli-core/types'\nimport {Mock, vi} from 'vitest'\n\ninterface MockCollection {\n DefaultProjectRoot: ProjectRootResult\n OclifCmdExit: Mock<Command['exit']>\n SanityCmdGetCliConfig: Mock\n SanityCmdGetProjectId: Mock\n SanityCmdGetProjectRoot: Mock<() => ProjectRootResult>\n SanityCmdIsUnattended: Mock\n SanityCmdOutput: Output\n SanityCmdResolveIsInteractive: Mock\n}\n\nconst DefaultProjectRoot = {\n directory: '/some/path/to/cli-test/mocks',\n path: '/some/path/to/cli-test/mocks/sanity.studio.ts',\n type: 'studio' as const,\n}\n\n/**\n * @internal\n */\nexport const mocks: MockCollection = {\n DefaultProjectRoot,\n // Mock OCLIF Command methods\n OclifCmdExit: vi.fn((_code?: number) => undefined as never),\n // Mock SanityCommand methods\n SanityCmdGetCliConfig: vi.fn(),\n SanityCmdGetProjectId: vi.fn(() => 'cli-test-mock-project-id'),\n SanityCmdGetProjectRoot: vi.fn(() => DefaultProjectRoot),\n SanityCmdIsUnattended: vi.fn(),\n SanityCmdOutput: createMockOutput(),\n SanityCmdResolveIsInteractive: vi.fn(),\n}\n\n/**\n * @internal\n */\nexport function createMockOutput(): Output {\n return {\n error: vi.fn(() => undefined as never),\n log: vi.fn(),\n warn: vi.fn(),\n }\n}\n\n/**\n * A mocked SanityCommand, for use in mocking out the `@sanity/cli-core/SanityCommand` module's command class.\n * @internal\n */\nexport class SanityCommand extends Command implements SanityCommandInterface {\n args = {}\n flags = {}\n output: Output = mocks.SanityCmdOutput\n public exit(code?: number) {\n return mocks.OclifCmdExit(code)\n }\n public async getCliConfig() {\n return mocks.SanityCmdGetCliConfig()\n }\n public async getProjectId(opts?: Record<string, any>) {\n return mocks.SanityCmdGetProjectId(opts)\n }\n public async getProjectRoot() {\n return mocks.SanityCmdGetProjectRoot()\n }\n // Same implementation as SanityCommand's, minus telemetry\n public async init(): Promise<void> {\n const {args, flags} = await this.parse({\n args: this.ctor.args,\n baseFlags: super.ctor.baseFlags,\n enableJsonFlag: this.ctor.enableJsonFlag,\n flags: this.ctor.flags,\n strict: this.ctor.strict,\n })\n\n this.args = args\n this.flags = flags\n\n await super.init()\n }\n public isUnattended() {\n return mocks.SanityCmdIsUnattended()\n }\n public resolveIsInteractive() {\n return mocks.SanityCmdResolveIsInteractive()\n }\n public async run() {}\n public async tryGetCliConfig() {\n return this.getCliConfig()\n }\n}\n"],"names":["Command","vi","DefaultProjectRoot","directory","path","type","mocks","OclifCmdExit","fn","_code","undefined","SanityCmdGetCliConfig","SanityCmdGetProjectId","SanityCmdGetProjectRoot","SanityCmdIsUnattended","SanityCmdOutput","createMockOutput","SanityCmdResolveIsInteractive","error","log","warn","SanityCommand","args","flags","output","exit","code","getCliConfig","getProjectId","opts","getProjectRoot","init","parse","ctor","baseFlags","enableJsonFlag","strict","isUnattended","resolveIsInteractive","run","tryGetCliConfig"],"mappings":"AAAA,SAAQA,OAAO,QAAO,cAAa;AAEnC,SAAcC,EAAE,QAAO,SAAQ;AAa/B,MAAMC,qBAAqB;IACzBC,WAAW;IACXC,MAAM;IACNC,MAAM;AACR;AAEA;;CAEC,GACD,OAAO,MAAMC,QAAwB;IACnCJ;IACA,6BAA6B;IAC7BK,cAAcN,GAAGO,EAAE,CAAC,CAACC,QAAmBC;IACxC,6BAA6B;IAC7BC,uBAAuBV,GAAGO,EAAE;IAC5BI,uBAAuBX,GAAGO,EAAE,CAAC,IAAM;IACnCK,yBAAyBZ,GAAGO,EAAE,CAAC,IAAMN;IACrCY,uBAAuBb,GAAGO,EAAE;IAC5BO,iBAAiBC;IACjBC,+BAA+BhB,GAAGO,EAAE;AACtC,EAAC;AAED;;CAEC,GACD,OAAO,SAASQ;IACd,OAAO;QACLE,OAAOjB,GAAGO,EAAE,CAAC,IAAME;QACnBS,KAAKlB,GAAGO,EAAE;QACVY,MAAMnB,GAAGO,EAAE;IACb;AACF;AAEA;;;CAGC,GACD,OAAO,MAAMa,sBAAsBrB;IACjCsB,OAAO,CAAC,EAAC;IACTC,QAAQ,CAAC,EAAC;IACVC,SAAiBlB,MAAMS,eAAe,CAAA;IAC/BU,KAAKC,IAAa,EAAE;QACzB,OAAOpB,MAAMC,YAAY,CAACmB;IAC5B;IACA,MAAaC,eAAe;QAC1B,OAAOrB,MAAMK,qBAAqB;IACpC;IACA,MAAaiB,aAAaC,IAA0B,EAAE;QACpD,OAAOvB,MAAMM,qBAAqB,CAACiB;IACrC;IACA,MAAaC,iBAAiB;QAC5B,OAAOxB,MAAMO,uBAAuB;IACtC;IACA,0DAA0D;IAC1D,MAAakB,OAAsB;QACjC,MAAM,EAACT,IAAI,EAAEC,KAAK,EAAC,GAAG,MAAM,IAAI,CAACS,KAAK,CAAC;YACrCV,MAAM,IAAI,CAACW,IAAI,CAACX,IAAI;YACpBY,WAAW,KAAK,CAACD,KAAKC,SAAS;YAC/BC,gBAAgB,IAAI,CAACF,IAAI,CAACE,cAAc;YACxCZ,OAAO,IAAI,CAACU,IAAI,CAACV,KAAK;YACtBa,QAAQ,IAAI,CAACH,IAAI,CAACG,MAAM;QAC1B;QAEA,IAAI,CAACd,IAAI,GAAGA;QACZ,IAAI,CAACC,KAAK,GAAGA;QAEb,MAAM,KAAK,CAACQ;IACd;IACOM,eAAe;QACpB,OAAO/B,MAAMQ,qBAAqB;IACpC;IACOwB,uBAAuB;QAC5B,OAAOhC,MAAMW,6BAA6B;IAC5C;IACA,MAAasB,MAAM,CAAC;IACpB,MAAaC,kBAAkB;QAC7B,OAAO,IAAI,CAACb,YAAY;IAC1B;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mocks/cli-core/apiClient.ts"],"sourcesContent":["import {type Mock, vi} from 'vitest'\n/** @internal */\nexport const getGlobalCliClient: Mock = vi.fn()\n/** @internal */\nexport const getProjectCliClient: Mock = vi.fn()\n"],"names":["vi","getGlobalCliClient","fn","getProjectCliClient"],"mappings":"AAAA,SAAmBA,EAAE,QAAO,SAAQ;AACpC,cAAc,GACd,OAAO,MAAMC,qBAA2BD,GAAGE,EAAE,GAAE;AAC/C,cAAc,GACd,OAAO,MAAMC,sBAA4BH,GAAGE,EAAE,GAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mocks/cli-core/browser.ts"],"sourcesContent":["import {type Mock, vi} from 'vitest'\n/** @internal */\nexport const mockBrowserEnvironment: Mock = vi.fn(() => vi.fn())\n"],"names":["vi","mockBrowserEnvironment","fn"],"mappings":"AAAA,SAAmBA,EAAE,QAAO,SAAQ;AACpC,cAAc,GACd,OAAO,MAAMC,yBAA+BD,GAAGE,EAAE,CAAC,IAAMF,GAAGE,EAAE,IAAG"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Mock } from "vitest";
|
|
2
|
+
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare const findProjectRoot: Mock;
|
|
5
|
+
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare const findProjectRootSync: Mock;
|
|
8
|
+
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const findStudioConfigPath: Mock;
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare const getCliConfig: Mock;
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const getCliConfigSync: Mock;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const getCliConfigUncached: Mock;
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const getCliToken: Mock;
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const getCliUserConfig: Mock;
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare const getSanityConfigDir: Mock;
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export declare const getSanityDataDir: Mock;
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export declare const getSanityEnvVar: Mock;
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export declare const getSanityUrl: Mock;
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export declare const getStudioConfig: Mock;
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export declare const getStudioWorkspaces: Mock;
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export declare const getUserConfig: Mock;
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
export declare const getWorkspace: Mock;
|
|
50
|
+
|
|
51
|
+
/** @internal */
|
|
52
|
+
export declare const isStudioConfig: Mock;
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
export declare const isWorkbenchApp: Mock;
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
export declare const parseWorkbenchCliConfig: Mock;
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export declare const setCliUserConfig: Mock;
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export declare const tryFindStudioConfigPath: Mock;
|
|
65
|
+
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
// TODO: consider a 'createMockConfig' helper function that returns a fake CliConfig object?
|
|
3
|
+
// do we do that in tests in this repo?
|
|
4
|
+
/** @internal */ export const getCliConfig = vi.fn();
|
|
5
|
+
/** @internal */ export const getCliConfigUncached = vi.fn();
|
|
6
|
+
/** @internal */ export const getCliConfigSync = vi.fn();
|
|
7
|
+
/** @internal */ export const isWorkbenchApp = vi.fn();
|
|
8
|
+
/** @internal */ export const parseWorkbenchCliConfig = vi.fn();
|
|
9
|
+
/** @internal */ export const findProjectRoot = vi.fn();
|
|
10
|
+
/** @internal */ export const findProjectRootSync = vi.fn();
|
|
11
|
+
/** @internal */ export const getStudioConfig = vi.fn();
|
|
12
|
+
/** @internal */ export const getStudioWorkspaces = vi.fn();
|
|
13
|
+
/** @internal */ export const isStudioConfig = vi.fn();
|
|
14
|
+
/** @internal */ export const findStudioConfigPath = vi.fn();
|
|
15
|
+
/** @internal */ export const tryFindStudioConfigPath = vi.fn();
|
|
16
|
+
/** @internal */ export const getSanityConfigDir = vi.fn();
|
|
17
|
+
/** @internal */ export const getSanityDataDir = vi.fn();
|
|
18
|
+
/** @internal */ export const getSanityEnvVar = vi.fn();
|
|
19
|
+
/** @internal */ export const getSanityUrl = vi.fn();
|
|
20
|
+
/** @internal */ export const getWorkspace = vi.fn();
|
|
21
|
+
/** @internal */ export const getCliToken = vi.fn();
|
|
22
|
+
/** @internal */ export const setCliUserConfig = vi.fn();
|
|
23
|
+
/** @internal */ export const getCliUserConfig = vi.fn();
|
|
24
|
+
/** @internal */ export const getUserConfig = vi.fn(()=>({
|
|
25
|
+
delete: vi.fn(),
|
|
26
|
+
get: vi.fn(),
|
|
27
|
+
set: vi.fn()
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mocks/cli-core/config.ts"],"sourcesContent":["import {type Mock, vi} from 'vitest'\n// TODO: consider a 'createMockConfig' helper function that returns a fake CliConfig object?\n// do we do that in tests in this repo?\n/** @internal */\nexport const getCliConfig: Mock = vi.fn()\n/** @internal */\nexport const getCliConfigUncached: Mock = vi.fn()\n/** @internal */\nexport const getCliConfigSync: Mock = vi.fn()\n/** @internal */\nexport const isWorkbenchApp: Mock = vi.fn()\n/** @internal */\nexport const parseWorkbenchCliConfig: Mock = vi.fn()\n/** @internal */\nexport const findProjectRoot: Mock = vi.fn()\n/** @internal */\nexport const findProjectRootSync: Mock = vi.fn()\n/** @internal */\nexport const getStudioConfig: Mock = vi.fn()\n/** @internal */\nexport const getStudioWorkspaces: Mock = vi.fn()\n/** @internal */\nexport const isStudioConfig: Mock = vi.fn()\n/** @internal */\nexport const findStudioConfigPath: Mock = vi.fn()\n/** @internal */\nexport const tryFindStudioConfigPath: Mock = vi.fn()\n/** @internal */\nexport const getSanityConfigDir: Mock = vi.fn()\n/** @internal */\nexport const getSanityDataDir: Mock = vi.fn()\n/** @internal */\nexport const getSanityEnvVar: Mock = vi.fn()\n/** @internal */\nexport const getSanityUrl: Mock = vi.fn()\n/** @internal */\nexport const getWorkspace: Mock = vi.fn()\n/** @internal */\nexport const getCliToken: Mock = vi.fn()\n/** @internal */\nexport const setCliUserConfig: Mock = vi.fn()\n/** @internal */\nexport const getCliUserConfig: Mock = vi.fn()\n/** @internal */\nexport const getUserConfig: Mock = vi.fn(() => ({\n delete: vi.fn(),\n get: vi.fn(),\n set: vi.fn(),\n}))\n"],"names":["vi","getCliConfig","fn","getCliConfigUncached","getCliConfigSync","isWorkbenchApp","parseWorkbenchCliConfig","findProjectRoot","findProjectRootSync","getStudioConfig","getStudioWorkspaces","isStudioConfig","findStudioConfigPath","tryFindStudioConfigPath","getSanityConfigDir","getSanityDataDir","getSanityEnvVar","getSanityUrl","getWorkspace","getCliToken","setCliUserConfig","getCliUserConfig","getUserConfig","delete","get","set"],"mappings":"AAAA,SAAmBA,EAAE,QAAO,SAAQ;AACpC,4FAA4F;AAC5F,uCAAuC;AACvC,cAAc,GACd,OAAO,MAAMC,eAAqBD,GAAGE,EAAE,GAAE;AACzC,cAAc,GACd,OAAO,MAAMC,uBAA6BH,GAAGE,EAAE,GAAE;AACjD,cAAc,GACd,OAAO,MAAME,mBAAyBJ,GAAGE,EAAE,GAAE;AAC7C,cAAc,GACd,OAAO,MAAMG,iBAAuBL,GAAGE,EAAE,GAAE;AAC3C,cAAc,GACd,OAAO,MAAMI,0BAAgCN,GAAGE,EAAE,GAAE;AACpD,cAAc,GACd,OAAO,MAAMK,kBAAwBP,GAAGE,EAAE,GAAE;AAC5C,cAAc,GACd,OAAO,MAAMM,sBAA4BR,GAAGE,EAAE,GAAE;AAChD,cAAc,GACd,OAAO,MAAMO,kBAAwBT,GAAGE,EAAE,GAAE;AAC5C,cAAc,GACd,OAAO,MAAMQ,sBAA4BV,GAAGE,EAAE,GAAE;AAChD,cAAc,GACd,OAAO,MAAMS,iBAAuBX,GAAGE,EAAE,GAAE;AAC3C,cAAc,GACd,OAAO,MAAMU,uBAA6BZ,GAAGE,EAAE,GAAE;AACjD,cAAc,GACd,OAAO,MAAMW,0BAAgCb,GAAGE,EAAE,GAAE;AACpD,cAAc,GACd,OAAO,MAAMY,qBAA2Bd,GAAGE,EAAE,GAAE;AAC/C,cAAc,GACd,OAAO,MAAMa,mBAAyBf,GAAGE,EAAE,GAAE;AAC7C,cAAc,GACd,OAAO,MAAMc,kBAAwBhB,GAAGE,EAAE,GAAE;AAC5C,cAAc,GACd,OAAO,MAAMe,eAAqBjB,GAAGE,EAAE,GAAE;AACzC,cAAc,GACd,OAAO,MAAMgB,eAAqBlB,GAAGE,EAAE,GAAE;AACzC,cAAc,GACd,OAAO,MAAMiB,cAAoBnB,GAAGE,EAAE,GAAE;AACxC,cAAc,GACd,OAAO,MAAMkB,mBAAyBpB,GAAGE,EAAE,GAAE;AAC7C,cAAc,GACd,OAAO,MAAMmB,mBAAyBrB,GAAGE,EAAE,GAAE;AAC7C,cAAc,GACd,OAAO,MAAMoB,gBAAsBtB,GAAGE,EAAE,CAAC,IAAO,CAAA;QAC9CqB,QAAQvB,GAAGE,EAAE;QACbsB,KAAKxB,GAAGE,EAAE;QACVuB,KAAKzB,GAAGE,EAAE;IACZ,CAAA,GAAG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Mock } from "vitest";
|
|
2
|
+
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare const getBinCommand: Mock;
|
|
5
|
+
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare const getLocalPackageDir: Mock;
|
|
8
|
+
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const getLocalPackageVersion: Mock;
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare const getRunningPackageManager: Mock;
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const getYarnMajorVersion: Mock;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const readPackageJson: Mock;
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const resolveLocalPackage: Mock;
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const resolveLocalPackageFrom: Mock;
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare const resolveLocalPackagePath: Mock;
|
|
29
|
+
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
/** @internal */ export const getLocalPackageDir = vi.fn();
|
|
3
|
+
/** @internal */ export const getLocalPackageVersion = vi.fn();
|
|
4
|
+
/** @internal */ export const getBinCommand = vi.fn();
|
|
5
|
+
/** @internal */ export const getRunningPackageManager = vi.fn();
|
|
6
|
+
/** @internal */ export const getYarnMajorVersion = vi.fn();
|
|
7
|
+
/** @internal */ export const readPackageJson = vi.fn();
|
|
8
|
+
/** @internal */ export const resolveLocalPackage = vi.fn();
|
|
9
|
+
/** @internal */ export const resolveLocalPackageFrom = vi.fn();
|
|
10
|
+
/** @internal */ export const resolveLocalPackagePath = vi.fn();
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=package-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mocks/cli-core/package-manager.ts"],"sourcesContent":["import {type Mock, vi} from 'vitest'\n\n/** @internal */\nexport const getLocalPackageDir: Mock = vi.fn()\n/** @internal */\nexport const getLocalPackageVersion: Mock = vi.fn()\n/** @internal */\nexport const getBinCommand: Mock = vi.fn()\n/** @internal */\nexport const getRunningPackageManager: Mock = vi.fn()\n/** @internal */\nexport const getYarnMajorVersion: Mock = vi.fn()\n/** @internal */\nexport const readPackageJson: Mock = vi.fn()\n/** @internal */\nexport const resolveLocalPackage: Mock = vi.fn()\n/** @internal */\nexport const resolveLocalPackageFrom: Mock = vi.fn()\n/** @internal */\nexport const resolveLocalPackagePath: Mock = vi.fn()\n"],"names":["vi","getLocalPackageDir","fn","getLocalPackageVersion","getBinCommand","getRunningPackageManager","getYarnMajorVersion","readPackageJson","resolveLocalPackage","resolveLocalPackageFrom","resolveLocalPackagePath"],"mappings":"AAAA,SAAmBA,EAAE,QAAO,SAAQ;AAEpC,cAAc,GACd,OAAO,MAAMC,qBAA2BD,GAAGE,EAAE,GAAE;AAC/C,cAAc,GACd,OAAO,MAAMC,yBAA+BH,GAAGE,EAAE,GAAE;AACnD,cAAc,GACd,OAAO,MAAME,gBAAsBJ,GAAGE,EAAE,GAAE;AAC1C,cAAc,GACd,OAAO,MAAMG,2BAAiCL,GAAGE,EAAE,GAAE;AACrD,cAAc,GACd,OAAO,MAAMI,sBAA4BN,GAAGE,EAAE,GAAE;AAChD,cAAc,GACd,OAAO,MAAMK,kBAAwBP,GAAGE,EAAE,GAAE;AAC5C,cAAc,GACd,OAAO,MAAMM,sBAA4BR,GAAGE,EAAE,GAAE;AAChD,cAAc,GACd,OAAO,MAAMO,0BAAgCT,GAAGE,EAAE,GAAE;AACpD,cAAc,GACd,OAAO,MAAMQ,0BAAgCV,GAAGE,EAAE,GAAE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Mock } from "vitest";
|
|
2
|
+
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare const agent: Mock;
|
|
5
|
+
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare const base: Mock;
|
|
8
|
+
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const createRequester: Mock;
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare const injectResponse: Mock;
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const jsonRequest: Mock;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const jsonResponse: Mock;
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const keepAlive: Mock;
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const mockRequest: Mock;
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare const observable: Mock;
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export declare const progress: Mock;
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export declare const proxy: Mock;
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export declare const retry: Mock;
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export declare const urlEncoded: Mock;
|
|
41
|
+
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
/** @internal */ export const mockRequest = vi.fn();
|
|
3
|
+
/** @internal */ export const createRequester = vi.fn(()=>mockRequest);
|
|
4
|
+
// get-it/middleware mocks
|
|
5
|
+
/** @internal */ export const agent = vi.fn(()=>({
|
|
6
|
+
finalizeOptions: vi.fn()
|
|
7
|
+
}));
|
|
8
|
+
/** @internal */ export const base = vi.fn(()=>({
|
|
9
|
+
processOptions: vi.fn()
|
|
10
|
+
}));
|
|
11
|
+
/** @internal */ export const injectResponse = vi.fn(()=>({
|
|
12
|
+
interceptRequest: vi.fn()
|
|
13
|
+
}));
|
|
14
|
+
/** @internal */ export const jsonRequest = vi.fn(()=>({
|
|
15
|
+
processOptions: vi.fn()
|
|
16
|
+
}));
|
|
17
|
+
/** @internal */ export const jsonResponse = vi.fn(()=>({
|
|
18
|
+
onResponse: vi.fn(),
|
|
19
|
+
processOptions: vi.fn()
|
|
20
|
+
}));
|
|
21
|
+
/** @internal */ export const keepAlive = vi.fn();
|
|
22
|
+
/** @internal */ export const observable = vi.fn(()=>({
|
|
23
|
+
onReturn: vi.fn()
|
|
24
|
+
}));
|
|
25
|
+
/** @internal */ export const progress = vi.fn(()=>({
|
|
26
|
+
onHeaders: vi.fn(),
|
|
27
|
+
onRequest: vi.fn(),
|
|
28
|
+
onResponse: vi.fn()
|
|
29
|
+
}));
|
|
30
|
+
/** @internal */ export const proxy = vi.fn(()=>({
|
|
31
|
+
processOptions: vi.fn()
|
|
32
|
+
}));
|
|
33
|
+
/** @internal */ export const retry = vi.fn(()=>({
|
|
34
|
+
onError: vi.fn()
|
|
35
|
+
}));
|
|
36
|
+
/** @internal */ export const urlEncoded = vi.fn(()=>({
|
|
37
|
+
processOptions: vi.fn()
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mocks/cli-core/request.ts"],"sourcesContent":["import {type Mock, vi} from 'vitest'\n/** @internal */\nexport const mockRequest: Mock = vi.fn()\n/** @internal */\nexport const createRequester: Mock = vi.fn(() => mockRequest)\n// get-it/middleware mocks\n/** @internal */\nexport const agent: Mock = vi.fn(() => ({finalizeOptions: vi.fn()}))\n/** @internal */\nexport const base: Mock = vi.fn(() => ({processOptions: vi.fn()}))\n/** @internal */\nexport const injectResponse: Mock = vi.fn(() => ({interceptRequest: vi.fn()}))\n/** @internal */\nexport const jsonRequest: Mock = vi.fn(() => ({processOptions: vi.fn()}))\n/** @internal */\nexport const jsonResponse: Mock = vi.fn(() => ({onResponse: vi.fn(), processOptions: vi.fn()}))\n/** @internal */\nexport const keepAlive: Mock = vi.fn()\n/** @internal */\nexport const observable: Mock = vi.fn(() => ({onReturn: vi.fn()}))\n/** @internal */\nexport const progress: Mock = vi.fn(() => ({\n onHeaders: vi.fn(),\n onRequest: vi.fn(),\n onResponse: vi.fn(),\n}))\n/** @internal */\nexport const proxy: Mock = vi.fn(() => ({processOptions: vi.fn()}))\n/** @internal */\nexport const retry: Mock = vi.fn(() => ({onError: vi.fn()}))\n/** @internal */\nexport const urlEncoded: Mock = vi.fn(() => ({processOptions: vi.fn()}))\n"],"names":["vi","mockRequest","fn","createRequester","agent","finalizeOptions","base","processOptions","injectResponse","interceptRequest","jsonRequest","jsonResponse","onResponse","keepAlive","observable","onReturn","progress","onHeaders","onRequest","proxy","retry","onError","urlEncoded"],"mappings":"AAAA,SAAmBA,EAAE,QAAO,SAAQ;AACpC,cAAc,GACd,OAAO,MAAMC,cAAoBD,GAAGE,EAAE,GAAE;AACxC,cAAc,GACd,OAAO,MAAMC,kBAAwBH,GAAGE,EAAE,CAAC,IAAMD,aAAY;AAC7D,0BAA0B;AAC1B,cAAc,GACd,OAAO,MAAMG,QAAcJ,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACG,iBAAiBL,GAAGE,EAAE;IAAE,CAAA,GAAG;AACpE,cAAc,GACd,OAAO,MAAMI,OAAaN,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACK,gBAAgBP,GAAGE,EAAE;IAAE,CAAA,GAAG;AAClE,cAAc,GACd,OAAO,MAAMM,iBAAuBR,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACO,kBAAkBT,GAAGE,EAAE;IAAE,CAAA,GAAG;AAC9E,cAAc,GACd,OAAO,MAAMQ,cAAoBV,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACK,gBAAgBP,GAAGE,EAAE;IAAE,CAAA,GAAG;AACzE,cAAc,GACd,OAAO,MAAMS,eAAqBX,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACU,YAAYZ,GAAGE,EAAE;QAAIK,gBAAgBP,GAAGE,EAAE;IAAE,CAAA,GAAG;AAC/F,cAAc,GACd,OAAO,MAAMW,YAAkBb,GAAGE,EAAE,GAAE;AACtC,cAAc,GACd,OAAO,MAAMY,aAAmBd,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACa,UAAUf,GAAGE,EAAE;IAAE,CAAA,GAAG;AAClE,cAAc,GACd,OAAO,MAAMc,WAAiBhB,GAAGE,EAAE,CAAC,IAAO,CAAA;QACzCe,WAAWjB,GAAGE,EAAE;QAChBgB,WAAWlB,GAAGE,EAAE;QAChBU,YAAYZ,GAAGE,EAAE;IACnB,CAAA,GAAG;AACH,cAAc,GACd,OAAO,MAAMiB,QAAcnB,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACK,gBAAgBP,GAAGE,EAAE;IAAE,CAAA,GAAG;AACnE,cAAc,GACd,OAAO,MAAMkB,QAAcpB,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACmB,SAASrB,GAAGE,EAAE;IAAE,CAAA,GAAG;AAC5D,cAAc,GACd,OAAO,MAAMoB,aAAmBtB,GAAGE,EAAE,CAAC,IAAO,CAAA;QAACK,gBAAgBP,GAAGE,EAAE;IAAE,CAAA,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mocks/cli-core/tasks.ts"],"sourcesContent":["import {type Mock, vi} from 'vitest'\n/** @internal */\nexport const createStudioWorker: Mock = vi.fn()\n/** @internal */\nexport const studioWorkerTask: Mock = vi.fn()\n/** @internal */\nexport const tsxWorkerTask: Mock = vi.fn()\n"],"names":["vi","createStudioWorker","fn","studioWorkerTask","tsxWorkerTask"],"mappings":"AAAA,SAAmBA,EAAE,QAAO,SAAQ;AACpC,cAAc,GACd,OAAO,MAAMC,qBAA2BD,GAAGE,EAAE,GAAE;AAC/C,cAAc,GACd,OAAO,MAAMC,mBAAyBH,GAAGE,EAAE,GAAE;AAC7C,cAAc,GACd,OAAO,MAAME,gBAAsBJ,GAAGE,EAAE,GAAE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CLITelemetryStore } from "@sanity/cli-core/types";
|
|
2
|
+
import { Mock } from "vitest";
|
|
3
|
+
import { MockedObject } from "vitest";
|
|
4
|
+
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const clearCliTelemetry: Mock;
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare const getCliTelemetry: Mock;
|
|
10
|
+
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const getTelemetryBaseInfo: Mock;
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const MockTelemetry: MockedObject<CLITelemetryStore>;
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare const MockTrace: Record<
|
|
19
|
+
"await" | "complete" | "error" | "log" | "start",
|
|
20
|
+
Mock
|
|
21
|
+
> & {
|
|
22
|
+
newContext: () => MockedObject<CLITelemetryStore>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const reportCliTraceError: Mock;
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare const setCliTelemetry: Mock;
|
|
30
|
+
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
/** @internal */ export const clearCliTelemetry = vi.fn();
|
|
3
|
+
/** @internal */ export const getCliTelemetry = vi.fn();
|
|
4
|
+
/** @internal */ export const reportCliTraceError = vi.fn();
|
|
5
|
+
/** @internal */ export const setCliTelemetry = vi.fn();
|
|
6
|
+
/** @internal */ export const getTelemetryBaseInfo = vi.fn();
|
|
7
|
+
/** @internal */ export const MockTrace = {
|
|
8
|
+
await: vi.fn(),
|
|
9
|
+
complete: vi.fn(),
|
|
10
|
+
error: vi.fn(),
|
|
11
|
+
log: vi.fn(),
|
|
12
|
+
newContext: ()=>MockTelemetry,
|
|
13
|
+
start: vi.fn()
|
|
14
|
+
};
|
|
15
|
+
/** @internal */ export const MockTelemetry = {
|
|
16
|
+
log: vi.fn(),
|
|
17
|
+
resume: vi.fn(),
|
|
18
|
+
trace: vi.fn(()=>MockTrace),
|
|
19
|
+
updateUserProperties: vi.fn()
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/mocks/cli-core/telemetry.ts"],"sourcesContent":["import {type CLITelemetryStore} from '@sanity/cli-core/types'\nimport {type Mock, MockedObject, vi} from 'vitest'\n/** @internal */\nexport const clearCliTelemetry: Mock = vi.fn()\n/** @internal */\nexport const getCliTelemetry: Mock = vi.fn()\n/** @internal */\nexport const reportCliTraceError: Mock = vi.fn()\n/** @internal */\nexport const setCliTelemetry: Mock = vi.fn()\n/** @internal */\nexport const getTelemetryBaseInfo: Mock = vi.fn()\n/** @internal */\nexport const MockTrace: Record<'await' | 'complete' | 'error' | 'log' | 'start', Mock> & {\n newContext: () => MockedObject<CLITelemetryStore>\n} = {\n await: vi.fn(),\n complete: vi.fn(),\n error: vi.fn(),\n log: vi.fn(),\n newContext: () => MockTelemetry,\n start: vi.fn(),\n}\n/** @internal */\nexport const MockTelemetry: MockedObject<CLITelemetryStore> = {\n log: vi.fn(),\n resume: vi.fn(),\n trace: vi.fn(() => MockTrace),\n updateUserProperties: vi.fn(),\n}\n"],"names":["vi","clearCliTelemetry","fn","getCliTelemetry","reportCliTraceError","setCliTelemetry","getTelemetryBaseInfo","MockTrace","await","complete","error","log","newContext","MockTelemetry","start","resume","trace","updateUserProperties"],"mappings":"AACA,SAAiCA,EAAE,QAAO,SAAQ;AAClD,cAAc,GACd,OAAO,MAAMC,oBAA0BD,GAAGE,EAAE,GAAE;AAC9C,cAAc,GACd,OAAO,MAAMC,kBAAwBH,GAAGE,EAAE,GAAE;AAC5C,cAAc,GACd,OAAO,MAAME,sBAA4BJ,GAAGE,EAAE,GAAE;AAChD,cAAc,GACd,OAAO,MAAMG,kBAAwBL,GAAGE,EAAE,GAAE;AAC5C,cAAc,GACd,OAAO,MAAMI,uBAA6BN,GAAGE,EAAE,GAAE;AACjD,cAAc,GACd,OAAO,MAAMK,YAET;IACFC,OAAOR,GAAGE,EAAE;IACZO,UAAUT,GAAGE,EAAE;IACfQ,OAAOV,GAAGE,EAAE;IACZS,KAAKX,GAAGE,EAAE;IACVU,YAAY,IAAMC;IAClBC,OAAOd,GAAGE,EAAE;AACd,EAAC;AACD,cAAc,GACd,OAAO,MAAMW,gBAAiD;IAC5DF,KAAKX,GAAGE,EAAE;IACVa,QAAQf,GAAGE,EAAE;IACbc,OAAOhB,GAAGE,EAAE,CAAC,IAAMK;IACnBU,sBAAsBjB,GAAGE,EAAE;AAC7B,EAAC"}
|