@sanity/cli-test 0.0.2-alpha.3 → 0.0.2-alpha.4
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 +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/test/createTestClient.d.ts +44 -0
- package/dist/test/createTestClient.js +51 -0
- package/dist/test/createTestClient.js.map +1 -0
- package/dist/test/createTestToken.d.ts +1 -0
- package/dist/test/createTestToken.js +6 -0
- package/dist/test/createTestToken.js.map +1 -0
- package/dist/test/mockSanityCommand.d.ts +45 -0
- package/dist/test/mockSanityCommand.js +52 -0
- package/dist/test/mockSanityCommand.js.map +1 -0
- package/dist/test/testCommand.d.ts +17 -2
- package/dist/test/testCommand.js +5 -3
- package/dist/test/testCommand.js.map +1 -1
- package/package.json +19 -8
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './test/mockApi.js'\nexport * from './test/testCommand.js'\nexport * from './test/testHook.js'\n"],"names":[],"mappings":"AAAA,cAAc,oBAAmB;AACjC,cAAc,wBAAuB;AACrC,cAAc,qBAAoB"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './test/createTestClient.js'\nexport * from './test/createTestToken.js'\nexport * from './test/mockApi.js'\nexport * from './test/mockSanityCommand.js'\nexport * from './test/testCommand.js'\nexport * from './test/testHook.js'\n"],"names":[],"mappings":"AAAA,cAAc,6BAA4B;AAC1C,cAAc,4BAA2B;AACzC,cAAc,oBAAmB;AACjC,cAAc,8BAA6B;AAC3C,cAAc,wBAAuB;AACrC,cAAc,qBAAoB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ClientConfig } from '@sanity/client';
|
|
2
|
+
export interface CreateTestClientOptions extends ClientConfig {
|
|
3
|
+
/**
|
|
4
|
+
* API version for the client
|
|
5
|
+
*/
|
|
6
|
+
apiVersion: string;
|
|
7
|
+
/**
|
|
8
|
+
* Authentication token
|
|
9
|
+
*/
|
|
10
|
+
token: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a real Sanity client instance for testing that makes actual HTTP requests.
|
|
14
|
+
* Use with mockApi() to intercept and mock the HTTP calls.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Mock getGlobalCliClient to return a test client
|
|
19
|
+
* vi.mock('@sanity/cli-core', async (importOriginal) => {
|
|
20
|
+
* const actual = await importOriginal<typeof import('@sanity/cli-core')>()
|
|
21
|
+
* const {createTestClient} = await import('@sanity/cli-test')
|
|
22
|
+
*
|
|
23
|
+
* return {
|
|
24
|
+
* ...actual,
|
|
25
|
+
* getGlobalCliClient: vi.fn().mockImplementation((opts) => {
|
|
26
|
+
* return Promise.resolve(createTestClient({
|
|
27
|
+
* apiVersion: opts.apiVersion,
|
|
28
|
+
* }))
|
|
29
|
+
* }),
|
|
30
|
+
* }
|
|
31
|
+
* })
|
|
32
|
+
*
|
|
33
|
+
* // Then use mockApi to intercept requests
|
|
34
|
+
* mockApi({
|
|
35
|
+
* apiVersion: 'v2025-02-19',
|
|
36
|
+
* method: 'get',
|
|
37
|
+
* uri: '/media-libraries',
|
|
38
|
+
* }).reply(200, {data: [...]})
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function createTestClient(options: CreateTestClientOptions): {
|
|
42
|
+
client: import("@sanity/client").SanityClient;
|
|
43
|
+
request: import("vitest").Mock<(options: import("@sanity/client").RawRequestOptions) => Promise<any>>;
|
|
44
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createClient } from '@sanity/client';
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a real Sanity client instance for testing that makes actual HTTP requests.
|
|
5
|
+
* Use with mockApi() to intercept and mock the HTTP calls.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Mock getGlobalCliClient to return a test client
|
|
10
|
+
* vi.mock('@sanity/cli-core', async (importOriginal) => {
|
|
11
|
+
* const actual = await importOriginal<typeof import('@sanity/cli-core')>()
|
|
12
|
+
* const {createTestClient} = await import('@sanity/cli-test')
|
|
13
|
+
*
|
|
14
|
+
* return {
|
|
15
|
+
* ...actual,
|
|
16
|
+
* getGlobalCliClient: vi.fn().mockImplementation((opts) => {
|
|
17
|
+
* return Promise.resolve(createTestClient({
|
|
18
|
+
* apiVersion: opts.apiVersion,
|
|
19
|
+
* }))
|
|
20
|
+
* }),
|
|
21
|
+
* }
|
|
22
|
+
* })
|
|
23
|
+
*
|
|
24
|
+
* // Then use mockApi to intercept requests
|
|
25
|
+
* mockApi({
|
|
26
|
+
* apiVersion: 'v2025-02-19',
|
|
27
|
+
* method: 'get',
|
|
28
|
+
* uri: '/media-libraries',
|
|
29
|
+
* }).reply(200, {data: [...]})
|
|
30
|
+
* ```
|
|
31
|
+
*/ export function createTestClient(options) {
|
|
32
|
+
const { apiVersion, projectId, token, ...rest } = options;
|
|
33
|
+
const client = createClient({
|
|
34
|
+
apiVersion,
|
|
35
|
+
projectId,
|
|
36
|
+
requestTagPrefix: 'sanity.cli',
|
|
37
|
+
token,
|
|
38
|
+
useCdn: false,
|
|
39
|
+
useProjectHostname: projectId ? true : false,
|
|
40
|
+
...rest
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Mock the request method of the client to return the actual response from the client
|
|
44
|
+
*/ const request = vi.fn((...args)=>client.request(...args));
|
|
45
|
+
return {
|
|
46
|
+
client,
|
|
47
|
+
request
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=createTestClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test/createTestClient.ts"],"sourcesContent":["import {type ClientConfig, createClient} from '@sanity/client'\nimport {vi} from 'vitest'\n\nexport interface CreateTestClientOptions extends ClientConfig {\n /**\n * API version for the client\n */\n apiVersion: string\n\n /**\n * Authentication token\n */\n token: string\n}\n\n/**\n * Creates a real Sanity client instance for testing that makes actual HTTP requests.\n * Use with mockApi() to intercept and mock the HTTP calls.\n *\n * @example\n * ```typescript\n * // Mock getGlobalCliClient to return a test client\n * vi.mock('@sanity/cli-core', async (importOriginal) => {\n * const actual = await importOriginal<typeof import('@sanity/cli-core')>()\n * const {createTestClient} = await import('@sanity/cli-test')\n *\n * return {\n * ...actual,\n * getGlobalCliClient: vi.fn().mockImplementation((opts) => {\n * return Promise.resolve(createTestClient({\n * apiVersion: opts.apiVersion,\n * }))\n * }),\n * }\n * })\n *\n * // Then use mockApi to intercept requests\n * mockApi({\n * apiVersion: 'v2025-02-19',\n * method: 'get',\n * uri: '/media-libraries',\n * }).reply(200, {data: [...]})\n * ```\n */\nexport function createTestClient(options: CreateTestClientOptions) {\n const {apiVersion, projectId, token, ...rest} = options\n\n const client = createClient({\n apiVersion,\n projectId,\n requestTagPrefix: 'sanity.cli',\n token,\n useCdn: false,\n useProjectHostname: projectId ? true : false,\n ...rest,\n })\n\n /**\n * Mock the request method of the client to return the actual response from the client\n */\n const request = vi.fn((...args: Parameters<typeof client.request>) => client.request(...args))\n\n return {\n client,\n request,\n }\n}\n"],"names":["createClient","vi","createTestClient","options","apiVersion","projectId","token","rest","client","requestTagPrefix","useCdn","useProjectHostname","request","fn","args"],"mappings":"AAAA,SAA2BA,YAAY,QAAO,iBAAgB;AAC9D,SAAQC,EAAE,QAAO,SAAQ;AAczB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GACD,OAAO,SAASC,iBAAiBC,OAAgC;IAC/D,MAAM,EAACC,UAAU,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGC,MAAK,GAAGJ;IAEhD,MAAMK,SAASR,aAAa;QAC1BI;QACAC;QACAI,kBAAkB;QAClBH;QACAI,QAAQ;QACRC,oBAAoBN,YAAY,OAAO;QACvC,GAAGE,IAAI;IACT;IAEA;;GAEC,GACD,MAAMK,UAAUX,GAAGY,EAAE,CAAC,CAAC,GAAGC,OAA4CN,OAAOI,OAAO,IAAIE;IAExF,OAAO;QACLN;QACAI;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createTestToken(token: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test/createTestToken.ts"],"sourcesContent":["import {vi} from 'vitest'\n\nexport function createTestToken(token: string) {\n vi.stubEnv('SANITY_AUTH_TOKEN', token)\n}\n"],"names":["vi","createTestToken","token","stubEnv"],"mappings":"AAAA,SAAQA,EAAE,QAAO,SAAQ;AAEzB,OAAO,SAASC,gBAAgBC,KAAa;IAC3CF,GAAGG,OAAO,CAAC,qBAAqBD;AAClC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type Command } from '@oclif/core';
|
|
2
|
+
import { type CliConfig, type ProjectRootResult, SanityCommand } from '@sanity/cli-core';
|
|
3
|
+
export interface MockSanityCommandOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Mock CLI config (required if command uses getCliConfig or getProjectId)
|
|
6
|
+
*/
|
|
7
|
+
cliConfig?: CliConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Mock whether the terminal is interactive (used by isUnattended)
|
|
10
|
+
*/
|
|
11
|
+
isInteractive?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Mock project root result (required if command uses getProjectRoot)
|
|
14
|
+
*/
|
|
15
|
+
projectRoot?: ProjectRootResult;
|
|
16
|
+
/**
|
|
17
|
+
* Mock authentication token (passed to API clients, bypasses getCliToken)
|
|
18
|
+
*/
|
|
19
|
+
token?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a testable subclass of a command with mocked SanityCommand dependencies.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Basic config mocking
|
|
27
|
+
* const TestAdd = mockSanityCommand(Add, {
|
|
28
|
+
* cliConfig: { api: { projectId: 'test-project' } }
|
|
29
|
+
* })
|
|
30
|
+
*
|
|
31
|
+
* // With mock API client
|
|
32
|
+
* const mockClient = {
|
|
33
|
+
* getDocument: vi.fn().mockResolvedValue({ _id: 'doc1', title: 'Test' }),
|
|
34
|
+
* fetch: vi.fn().mockResolvedValue([]),
|
|
35
|
+
* }
|
|
36
|
+
* const TestGet = mockSanityCommand(GetDocumentCommand, {
|
|
37
|
+
* cliConfig: { api: { projectId: 'test-project', dataset: 'production' } },
|
|
38
|
+
* projectApiClient: mockClient,
|
|
39
|
+
* })
|
|
40
|
+
*
|
|
41
|
+
* const {stdout} = await testCommand(TestGet, ['doc1'])
|
|
42
|
+
* expect(mockClient.getDocument).toHaveBeenCalledWith('doc1')
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function mockSanityCommand<T extends typeof SanityCommand<typeof Command>>(CommandClass: T, options?: MockSanityCommandOptions): T;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a testable subclass of a command with mocked SanityCommand dependencies.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* // Basic config mocking
|
|
7
|
+
* const TestAdd = mockSanityCommand(Add, {
|
|
8
|
+
* cliConfig: { api: { projectId: 'test-project' } }
|
|
9
|
+
* })
|
|
10
|
+
*
|
|
11
|
+
* // With mock API client
|
|
12
|
+
* const mockClient = {
|
|
13
|
+
* getDocument: vi.fn().mockResolvedValue({ _id: 'doc1', title: 'Test' }),
|
|
14
|
+
* fetch: vi.fn().mockResolvedValue([]),
|
|
15
|
+
* }
|
|
16
|
+
* const TestGet = mockSanityCommand(GetDocumentCommand, {
|
|
17
|
+
* cliConfig: { api: { projectId: 'test-project', dataset: 'production' } },
|
|
18
|
+
* projectApiClient: mockClient,
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* const {stdout} = await testCommand(TestGet, ['doc1'])
|
|
22
|
+
* expect(mockClient.getDocument).toHaveBeenCalledWith('doc1')
|
|
23
|
+
* ```
|
|
24
|
+
*/ export function mockSanityCommand(CommandClass, options = {}) {
|
|
25
|
+
// Create a subclass that overrides methods when mocks are provided
|
|
26
|
+
// Note: we use @ts-expect-error because TypeScript can't properly infer
|
|
27
|
+
// the relationship between the generic CommandClass and SanityCommand
|
|
28
|
+
// @ts-expect-error - TypeScript struggles with abstract class subclassing
|
|
29
|
+
class MockedCommand extends CommandClass {
|
|
30
|
+
getCliConfig() {
|
|
31
|
+
if (options.cliConfig) {
|
|
32
|
+
return Promise.resolve(options.cliConfig);
|
|
33
|
+
}
|
|
34
|
+
return super.getCliConfig();
|
|
35
|
+
}
|
|
36
|
+
getProjectRoot() {
|
|
37
|
+
if (options.projectRoot) {
|
|
38
|
+
return Promise.resolve(options.projectRoot);
|
|
39
|
+
}
|
|
40
|
+
return super.getProjectRoot();
|
|
41
|
+
}
|
|
42
|
+
resolveIsInteractive() {
|
|
43
|
+
if (options.isInteractive !== undefined) {
|
|
44
|
+
return options.isInteractive;
|
|
45
|
+
}
|
|
46
|
+
return super.resolveIsInteractive();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return MockedCommand;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=mockSanityCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test/mockSanityCommand.ts"],"sourcesContent":["import {type Command} from '@oclif/core'\nimport {type CliConfig, type ProjectRootResult, SanityCommand} from '@sanity/cli-core'\n\nexport interface MockSanityCommandOptions {\n /**\n * Mock CLI config (required if command uses getCliConfig or getProjectId)\n */\n cliConfig?: CliConfig\n /**\n * Mock whether the terminal is interactive (used by isUnattended)\n */\n isInteractive?: boolean\n /**\n * Mock project root result (required if command uses getProjectRoot)\n */\n projectRoot?: ProjectRootResult\n /**\n * Mock authentication token (passed to API clients, bypasses getCliToken)\n */\n token?: string\n}\n\n/**\n * Creates a testable subclass of a command with mocked SanityCommand dependencies.\n *\n * @example\n * ```ts\n * // Basic config mocking\n * const TestAdd = mockSanityCommand(Add, {\n * cliConfig: { api: { projectId: 'test-project' } }\n * })\n *\n * // With mock API client\n * const mockClient = {\n * getDocument: vi.fn().mockResolvedValue({ _id: 'doc1', title: 'Test' }),\n * fetch: vi.fn().mockResolvedValue([]),\n * }\n * const TestGet = mockSanityCommand(GetDocumentCommand, {\n * cliConfig: { api: { projectId: 'test-project', dataset: 'production' } },\n * projectApiClient: mockClient,\n * })\n *\n * const {stdout} = await testCommand(TestGet, ['doc1'])\n * expect(mockClient.getDocument).toHaveBeenCalledWith('doc1')\n * ```\n */\nexport function mockSanityCommand<T extends typeof SanityCommand<typeof Command>>(\n CommandClass: T,\n options: MockSanityCommandOptions = {},\n): T {\n // Create a subclass that overrides methods when mocks are provided\n // Note: we use @ts-expect-error because TypeScript can't properly infer\n // the relationship between the generic CommandClass and SanityCommand\n // @ts-expect-error - TypeScript struggles with abstract class subclassing\n class MockedCommand extends CommandClass {\n protected getCliConfig(): Promise<CliConfig> {\n if (options.cliConfig) {\n return Promise.resolve(options.cliConfig)\n }\n return super.getCliConfig()\n }\n\n protected getProjectRoot(): Promise<ProjectRootResult> {\n if (options.projectRoot) {\n return Promise.resolve(options.projectRoot)\n }\n return super.getProjectRoot()\n }\n\n protected resolveIsInteractive(): boolean {\n if (options.isInteractive !== undefined) {\n return options.isInteractive\n }\n return super.resolveIsInteractive()\n }\n }\n\n return MockedCommand as T\n}\n"],"names":["mockSanityCommand","CommandClass","options","MockedCommand","getCliConfig","cliConfig","Promise","resolve","getProjectRoot","projectRoot","resolveIsInteractive","isInteractive","undefined"],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASA,kBACdC,YAAe,EACfC,UAAoC,CAAC,CAAC;IAEtC,mEAAmE;IACnE,wEAAwE;IACxE,sEAAsE;IACtE,0EAA0E;IAC1E,MAAMC,sBAAsBF;QAChBG,eAAmC;YAC3C,IAAIF,QAAQG,SAAS,EAAE;gBACrB,OAAOC,QAAQC,OAAO,CAACL,QAAQG,SAAS;YAC1C;YACA,OAAO,KAAK,CAACD;QACf;QAEUI,iBAA6C;YACrD,IAAIN,QAAQO,WAAW,EAAE;gBACvB,OAAOH,QAAQC,OAAO,CAACL,QAAQO,WAAW;YAC5C;YACA,OAAO,KAAK,CAACD;QACf;QAEUE,uBAAgC;YACxC,IAAIR,QAAQS,aAAa,KAAKC,WAAW;gBACvC,OAAOV,QAAQS,aAAa;YAC9B;YACA,OAAO,KAAK,CAACD;QACf;IACF;IAEA,OAAOP;AACT"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { Command, Config } from '@oclif/core';
|
|
2
2
|
import { type CaptureOptions, type CaptureResult } from './captureOutput.js';
|
|
3
|
-
|
|
3
|
+
import { type MockSanityCommandOptions } from './mockSanityCommand.js';
|
|
4
|
+
type CommandClass = (new (argv: string[], config: Config) => Command) & typeof Command;
|
|
5
|
+
export interface TestCommandOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Options for capturing output
|
|
8
|
+
*/
|
|
4
9
|
capture?: CaptureOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Partial oclif config overrides
|
|
12
|
+
*/
|
|
5
13
|
config?: Partial<Config>;
|
|
6
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Mock options for SanityCommand dependencies (config, project root, API clients).
|
|
16
|
+
* When provided, the command is automatically wrapped with mockSanityCommand.
|
|
17
|
+
*/
|
|
18
|
+
mocks?: MockSanityCommandOptions;
|
|
19
|
+
}
|
|
20
|
+
export declare function testCommand(command: CommandClass, args?: string[], options?: TestCommandOptions): Promise<CaptureResult<unknown>>;
|
|
21
|
+
export {};
|
package/dist/test/testCommand.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
1
|
import { fileURLToPath } from 'node:url';
|
|
3
2
|
import { captureOutput } from './captureOutput.js';
|
|
3
|
+
import { mockSanityCommand } from './mockSanityCommand.js';
|
|
4
4
|
export async function testCommand(command, args, options) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
// If mocks provided, wrap the command with mockSanityCommand
|
|
6
|
+
const CommandToRun = options?.mocks ? mockSanityCommand(command, options.mocks) : command;
|
|
7
|
+
const commandInstancePromise = ()=>CommandToRun.run(args || [], {
|
|
8
|
+
root: fileURLToPath(import.meta.url),
|
|
7
9
|
...options?.config
|
|
8
10
|
});
|
|
9
11
|
return captureOutput(commandInstancePromise, options?.capture);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/testCommand.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/test/testCommand.ts"],"sourcesContent":["import {fileURLToPath} from 'node:url'\n\nimport {Command, Config} from '@oclif/core'\n\nimport {type CaptureOptions, captureOutput, type CaptureResult} from './captureOutput.js'\nimport {mockSanityCommand, type MockSanityCommandOptions} from './mockSanityCommand.js'\n\ntype CommandClass = (new (argv: string[], config: Config) => Command) & typeof Command\n\nexport interface TestCommandOptions {\n /**\n * Options for capturing output\n */\n capture?: CaptureOptions\n /**\n * Partial oclif config overrides\n */\n config?: Partial<Config>\n /**\n * Mock options for SanityCommand dependencies (config, project root, API clients).\n * When provided, the command is automatically wrapped with mockSanityCommand.\n */\n mocks?: MockSanityCommandOptions\n}\n\nexport async function testCommand(\n command: CommandClass,\n args?: string[],\n options?: TestCommandOptions,\n): Promise<CaptureResult<unknown>> {\n // If mocks provided, wrap the command with mockSanityCommand\n const CommandToRun = options?.mocks\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (mockSanityCommand(command as any, options.mocks) as CommandClass)\n : command\n\n const commandInstancePromise = () =>\n CommandToRun.run(args || [], {\n root: fileURLToPath(import.meta.url),\n ...options?.config,\n })\n\n return captureOutput(commandInstancePromise, options?.capture)\n}\n"],"names":["fileURLToPath","captureOutput","mockSanityCommand","testCommand","command","args","options","CommandToRun","mocks","commandInstancePromise","run","root","url","config","capture"],"mappings":"AAAA,SAAQA,aAAa,QAAO,WAAU;AAItC,SAA6BC,aAAa,QAA2B,qBAAoB;AACzF,SAAQC,iBAAiB,QAAsC,yBAAwB;AAoBvF,OAAO,eAAeC,YACpBC,OAAqB,EACrBC,IAAe,EACfC,OAA4B;IAE5B,6DAA6D;IAC7D,MAAMC,eAAeD,SAASE,QAEzBN,kBAAkBE,SAAgBE,QAAQE,KAAK,IAChDJ;IAEJ,MAAMK,yBAAyB,IAC7BF,aAAaG,GAAG,CAACL,QAAQ,EAAE,EAAE;YAC3BM,MAAMX,cAAc,YAAYY,GAAG;YACnC,GAAGN,SAASO,MAAM;QACpB;IAEF,OAAOZ,cAAcQ,wBAAwBH,SAASQ;AACxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli-test",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.4",
|
|
4
4
|
"description": "Sanity CLI test helpers and utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
],
|
|
14
14
|
"homepage": "https://github.com/sanity-io/cli",
|
|
15
15
|
"bugs": "https://github.com/sanity-io/cli/issues",
|
|
16
|
-
"repository":
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/sanity-io/cli.git",
|
|
19
|
+
"directory": "packages/@sanity/cli-test"
|
|
20
|
+
},
|
|
17
21
|
"license": "MIT",
|
|
18
22
|
"author": "Sanity.io <hello@sanity.io>",
|
|
19
23
|
"type": "module",
|
|
@@ -32,21 +36,28 @@
|
|
|
32
36
|
],
|
|
33
37
|
"dependencies": {
|
|
34
38
|
"@oclif/core": "^4.8.0",
|
|
35
|
-
"ansis": "^
|
|
36
|
-
"nock": "^14.0.
|
|
39
|
+
"ansis": "^4.2.0",
|
|
40
|
+
"nock": "^14.0.10"
|
|
37
41
|
},
|
|
38
42
|
"devDependencies": {
|
|
39
43
|
"@eslint/compat": "^2.0.0",
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
44
|
+
"@oclif/core": "^4.8.0",
|
|
45
|
+
"@sanity/client": "^7.3.0",
|
|
46
|
+
"@swc/cli": "^0.7.9",
|
|
47
|
+
"@swc/core": "^1.15.8",
|
|
42
48
|
"@types/debug": "^4.1.12",
|
|
43
|
-
"@types/node": "^20.19.
|
|
49
|
+
"@types/node": "^20.19.27",
|
|
44
50
|
"eslint": "^9.39.2",
|
|
45
|
-
"typescript": "^5.
|
|
51
|
+
"typescript": "^5.9.3",
|
|
46
52
|
"vitest": "^3.2.4",
|
|
47
53
|
"@repo/tsconfig": "3.70.0",
|
|
54
|
+
"@sanity/cli-core": "0.1.0-alpha.5",
|
|
48
55
|
"@sanity/eslint-config-cli": "0.0.0-alpha.1"
|
|
49
56
|
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@oclif/core": "^4.0.0",
|
|
59
|
+
"@sanity/cli-core": "0.1.0-alpha.5"
|
|
60
|
+
},
|
|
50
61
|
"engines": {
|
|
51
62
|
"node": ">=20.19.1 <22 || >=22.12"
|
|
52
63
|
},
|