@sanity/cli-test 2.0.3 → 3.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 CHANGED
@@ -11,6 +11,7 @@ import nock from "nock";
11
11
  import { ProjectRootResult } from "@sanity/cli-core";
12
12
  import { SanityClient } from "@sanity/client";
13
13
  import { SanityCommand } from "@sanity/cli-core";
14
+ import { SpinnerInstance } from "@sanity/cli-core/ux";
14
15
  import { TestProject } from "vitest/node";
15
16
  import { vi } from "vitest";
16
17
 
@@ -60,6 +61,15 @@ export declare function createMockHttpServer(): {
60
61
  once(event: string, listener: (...args: unknown[]) => void): void;
61
62
  };
62
63
 
64
+ /**
65
+ * Creates a mock spinner function to avoid writing output to stdout.
66
+ * @param overrides - Pass any mocks or stubs for test expectations
67
+ * @internal
68
+ */
69
+ export declare function createMockSpinner(
70
+ overrides?: Partial<SpinnerInstance>,
71
+ ): Mock<(options: string) => SpinnerInstance>;
72
+
63
73
  /**
64
74
  * Creates a mock Vite watcher for testing.
65
75
  *
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './test/constants.js';
2
2
  export * from './test/createMockHttpServer.js';
3
+ export { createMockSpinner } from './test/createMockSpinner.js';
3
4
  export * from './test/createMockWatcher.js';
4
5
  export * from './test/createTestClient.js';
5
6
  export * from './test/createTestToken.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * 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"],"names":[],"mappings":"AAAA,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"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './test/constants.js'\nexport * from './test/createMockHttpServer.js'\nexport {createMockSpinner} from './test/createMockSpinner.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"],"names":["createMockSpinner"],"mappings":"AAAA,cAAc,sBAAqB;AACnC,cAAc,iCAAgC;AAC9C,SAAQA,iBAAiB,QAAO,8BAA6B;AAC7D,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"}
@@ -0,0 +1,55 @@
1
+ import { vi } from 'vitest';
2
+ /**
3
+ * Creates a mock spinner function to avoid writing output to stdout.
4
+ * @param overrides - Pass any mocks or stubs for test expectations
5
+ * @internal
6
+ */ export function createMockSpinner(overrides) {
7
+ return vi.fn(()=>{
8
+ return {
9
+ clear: function() {
10
+ throw new Error('Function not implemented.');
11
+ },
12
+ color: false,
13
+ fail: function(_text) {
14
+ throw new Error('Function not implemented.');
15
+ },
16
+ frame: function() {
17
+ throw new Error('Function not implemented.');
18
+ },
19
+ indent: 0,
20
+ info: function(_text) {
21
+ throw new Error('Function not implemented.');
22
+ },
23
+ interval: 0,
24
+ isSpinning: false,
25
+ prefixText: '',
26
+ render: function() {
27
+ throw new Error('Function not implemented.');
28
+ },
29
+ spinner: {
30
+ frames: [],
31
+ interval: undefined
32
+ },
33
+ start: function(_text) {
34
+ throw new Error('Function not implemented.');
35
+ },
36
+ stop: function() {
37
+ throw new Error('Function not implemented.');
38
+ },
39
+ stopAndPersist: function(_options) {
40
+ throw new Error('Function not implemented.');
41
+ },
42
+ succeed: function(_text) {
43
+ throw new Error('Function not implemented.');
44
+ },
45
+ suffixText: '',
46
+ text: '',
47
+ warn: function(_text) {
48
+ throw new Error('Function not implemented.');
49
+ },
50
+ ...overrides
51
+ };
52
+ });
53
+ }
54
+
55
+ //# sourceMappingURL=createMockSpinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/test/createMockSpinner.ts"],"sourcesContent":["import {type SpinnerInstance} from '@sanity/cli-core/ux'\nimport {type PersistOptions} from 'ora'\nimport {Mock, vi} from 'vitest'\n\n/**\n * Creates a mock spinner function to avoid writing output to stdout.\n * @param overrides - Pass any mocks or stubs for test expectations\n * @internal\n */\nexport function createMockSpinner(\n overrides?: Partial<SpinnerInstance>,\n): Mock<(options: string) => SpinnerInstance> {\n return vi.fn(() => {\n return {\n clear: function (): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n color: false,\n fail: function (_text?: string): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n frame: function (): string {\n throw new Error('Function not implemented.')\n },\n indent: 0,\n info: function (_text?: string): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n interval: 0,\n isSpinning: false,\n prefixText: '',\n render: function (): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n spinner: {\n frames: [],\n interval: undefined,\n },\n start: function (_text?: string): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n stop: function (): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n stopAndPersist: function (_options?: PersistOptions): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n succeed: function (_text?: string): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n suffixText: '',\n text: '',\n warn: function (_text?: string): SpinnerInstance {\n throw new Error('Function not implemented.')\n },\n ...overrides,\n }\n })\n}\n"],"names":["vi","createMockSpinner","overrides","fn","clear","Error","color","fail","_text","frame","indent","info","interval","isSpinning","prefixText","render","spinner","frames","undefined","start","stop","stopAndPersist","_options","succeed","suffixText","text","warn"],"mappings":"AAEA,SAAcA,EAAE,QAAO,SAAQ;AAE/B;;;;CAIC,GACD,OAAO,SAASC,kBACdC,SAAoC;IAEpC,OAAOF,GAAGG,EAAE,CAAC;QACX,OAAO;YACLC,OAAO;gBACL,MAAM,IAAIC,MAAM;YAClB;YACAC,OAAO;YACPC,MAAM,SAAUC,KAAc;gBAC5B,MAAM,IAAIH,MAAM;YAClB;YACAI,OAAO;gBACL,MAAM,IAAIJ,MAAM;YAClB;YACAK,QAAQ;YACRC,MAAM,SAAUH,KAAc;gBAC5B,MAAM,IAAIH,MAAM;YAClB;YACAO,UAAU;YACVC,YAAY;YACZC,YAAY;YACZC,QAAQ;gBACN,MAAM,IAAIV,MAAM;YAClB;YACAW,SAAS;gBACPC,QAAQ,EAAE;gBACVL,UAAUM;YACZ;YACAC,OAAO,SAAUX,KAAc;gBAC7B,MAAM,IAAIH,MAAM;YAClB;YACAe,MAAM;gBACJ,MAAM,IAAIf,MAAM;YAClB;YACAgB,gBAAgB,SAAUC,QAAyB;gBACjD,MAAM,IAAIjB,MAAM;YAClB;YACAkB,SAAS,SAAUf,KAAc;gBAC/B,MAAM,IAAIH,MAAM;YAClB;YACAmB,YAAY;YACZC,MAAM;YACNC,MAAM,SAAUlB,KAAc;gBAC5B,MAAM,IAAIH,MAAM;YAClB;YACA,GAAGH,SAAS;QACd;IACF;AACF"}
@@ -28,6 +28,6 @@
28
28
  "@sanity/color": "^3.0.6",
29
29
  "@types/react": "^19.2.14",
30
30
  "typescript": "^5.9.3",
31
- "vite": "^8.1.2"
31
+ "vite": "^8.1.3"
32
32
  }
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-test",
3
- "version": "2.0.3",
3
+ "version": "3.0.0",
4
4
  "description": "Sanity CLI test helpers and utilities",
5
5
  "keywords": [
6
6
  "cli",
@@ -49,7 +49,7 @@
49
49
  "nock": "^14.0.15",
50
50
  "ora": "^9.0.0",
51
51
  "tinyglobby": "^0.2.17",
52
- "@sanity/cli-core": "2.1.3"
52
+ "@sanity/cli-core": "2.2.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@eslint/compat": "^2.1.0",
@@ -73,7 +73,7 @@
73
73
  "@oclif/core": "^4.0.0",
74
74
  "@sanity/client": "^7.0.0",
75
75
  "vitest": ">=3.0.0 <5.0.0",
76
- "@sanity/cli-core": "2.1.3"
76
+ "@sanity/cli-core": "2.2.0"
77
77
  },
78
78
  "engines": {
79
79
  "node": ">=22.12"