@sanity/cli-test 3.0.1 → 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
|
@@ -2,7 +2,6 @@ import { exec as execNode } from 'node:child_process';
|
|
|
2
2
|
import { readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { basename, join } from 'node:path';
|
|
4
4
|
import { promisify } from 'node:util';
|
|
5
|
-
import ora from 'ora';
|
|
6
5
|
import { glob } from 'tinyglobby';
|
|
7
6
|
import { fileExists } from '../utils/fileExists.js';
|
|
8
7
|
import { getFixturesPath, getTempPath } from '../utils/paths.js';
|
|
@@ -55,11 +54,9 @@ async function getAdditionalFixturePaths(fixtures) {
|
|
|
55
54
|
* ```
|
|
56
55
|
*/ export async function setup(_, options = {}) {
|
|
57
56
|
const { additionalFixtures, ignoreWorkspace, tempDir } = options;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
text: 'Initializing test environment...'
|
|
62
|
-
}).start();
|
|
57
|
+
console.log('Initializing test environment...');
|
|
58
|
+
const timerLabel = 'Test environment initialization';
|
|
59
|
+
console.time(timerLabel);
|
|
63
60
|
try {
|
|
64
61
|
const fixturesDir = getFixturesPath();
|
|
65
62
|
const tempDirectory = getTempPath(tempDir);
|
|
@@ -78,7 +75,7 @@ async function getAdditionalFixturePaths(fixtures) {
|
|
|
78
75
|
if (additionalFixturePaths.length > 0) {
|
|
79
76
|
allFixturePaths.push(...additionalFixturePaths);
|
|
80
77
|
} else {
|
|
81
|
-
|
|
78
|
+
console.warn(`No additional fixtures found, check the glob pattern: ${additionalFixtures.join(', ')}`);
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
81
|
for (const { fixture, fromPath, includeDist } of allFixturePaths){
|
|
@@ -108,17 +105,18 @@ async function getAdditionalFixturePaths(fixtures) {
|
|
|
108
105
|
});
|
|
109
106
|
} catch (error) {
|
|
110
107
|
const execError = error;
|
|
111
|
-
|
|
108
|
+
console.error('Failed to install dependencies');
|
|
112
109
|
console.error(execError.stderr || execError.stdout || execError.message);
|
|
113
110
|
throw new Error(`Error installing dependencies in ${toPath}: ${execError.stderr || execError.stdout || execError.message}`, {
|
|
114
111
|
cause: error
|
|
115
112
|
});
|
|
116
113
|
}
|
|
117
114
|
}
|
|
118
|
-
spinner.succeed('Test environment initialized');
|
|
119
115
|
} catch (error) {
|
|
120
|
-
|
|
116
|
+
console.error('Failed to initialize test environment!');
|
|
121
117
|
throw error;
|
|
118
|
+
} finally{
|
|
119
|
+
console.timeEnd(timerLabel);
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/setupFixtures.ts"],"sourcesContent":["import {exec as execNode} from 'node:child_process'\nimport {readFile, rm, writeFile} from 'node:fs/promises'\nimport {basename, join} from 'node:path'\nimport {promisify} from 'node:util'\n\nimport ora from 'ora'\nimport {glob} from 'tinyglobby'\nimport {type TestProject} from 'vitest/node'\n\nimport {fileExists} from '../utils/fileExists.js'\nimport {getFixturesPath, getTempPath} from '../utils/paths.js'\nimport {DEFAULT_FIXTURES} from './constants.js'\nimport {testCopyDirectory} from './testFixture.js'\n\nconst exec = promisify(execNode)\n\n/**\n * Options for setupTestFixtures\n *\n * @public\n */\nexport interface SetupTestFixturesOptions {\n /**\n * Glob patterns for additional fixture directories to set up.\n *\n * Each pattern is matched against directories in the current working directory.\n * Only directories containing a `package.json` file are included.\n *\n * @example\n * ```typescript\n * ['fixtures/*', 'dev/*']\n * ```\n */\n additionalFixtures?: string[]\n\n /**\n * When true, passes `--ignore-workspace` to pnpm install so fixtures get\n * their own node_modules even when the temp directory is inside a pnpm\n * workspace. Required for E2E tests that spawn the CLI binary against\n * fixture directories.\n */\n ignoreWorkspace?: boolean\n\n /**\n * Custom temp directory path. Defaults to process.cwd()/tmp\n */\n tempDir?: string\n}\n\nasync function getAdditionalFixturePaths(fixtures: string[]): Promise<FixtureDetails[]> {\n const paths = await glob(fixtures, {\n absolute: true,\n ignore: ['**/node_modules/**', '**/dist/**'],\n onlyDirectories: true,\n })\n\n const additionalFixtures: FixtureDetails[] = []\n\n for (const path of paths) {\n if (await fileExists(join(`${path}/package.json`))) {\n additionalFixtures.push({\n fixture: basename(path),\n fromPath: path,\n includeDist: false,\n })\n }\n }\n\n return additionalFixtures\n}\n\ninterface FixtureDetails {\n fixture: string\n fromPath: string\n includeDist: boolean\n}\n\n/**\n * Global setup function for initializing test fixtures.\n *\n * Copies fixtures from the bundled location to a temp directory\n * and installs dependencies.\n *\n * Note: Fixtures are NOT built during setup. Tests that need built\n * fixtures should build them as part of the test.\n *\n * This function is designed to be used with vitest globalSetup.\n *\n * @public\n *\n * @param options - Configuration options\n * @example\n * ```typescript\n * // In vitest.config.ts\n * export default defineConfig({\n * test: {\n * globalSetup: ['@sanity/cli-test/vitest']\n * }\n * })\n * ```\n */\nexport async function setup(_: TestProject, options: SetupTestFixturesOptions = {}): Promise<void> {\n const {additionalFixtures, ignoreWorkspace, tempDir} = options\n\n const spinner = ora({\n // Without this, the watch mode input is discarded\n discardStdin: false,\n text: 'Initializing test environment...',\n }).start()\n\n try {\n const fixturesDir = getFixturesPath()\n const tempDirectory = getTempPath(tempDir)\n\n const allFixturePaths: FixtureDetails[] = []\n\n // Add the default fixtures\n for (const [fixture, options] of Object.entries(DEFAULT_FIXTURES)) {\n allFixturePaths.push({\n fixture,\n fromPath: join(fixturesDir, fixture),\n includeDist: 'includeDist' in options && options.includeDist ? options.includeDist : false,\n })\n }\n\n // Add the additional fixtures\n if (additionalFixtures && additionalFixtures.length > 0) {\n const additionalFixturePaths = await getAdditionalFixturePaths(additionalFixtures)\n\n if (additionalFixturePaths.length > 0) {\n allFixturePaths.push(...additionalFixturePaths)\n } else {\n spinner.warn(\n `No additional fixtures found, check the glob pattern: ${additionalFixtures.join(', ')}`,\n )\n }\n }\n\n for (const {fixture, fromPath, includeDist} of allFixturePaths) {\n const toPath = join(tempDirectory, `fixture-${fixture}`)\n // Copy the fixture, excluding node_modules and dist\n await testCopyDirectory(fromPath, toPath, ['node_modules', ...(includeDist ? [] : ['dist'])])\n\n // Replace the package.json name with a temp name\n const packageJsonPath = join(toPath, 'package.json')\n const packageJson = await readFile(packageJsonPath, 'utf8')\n const packageJsonData = JSON.parse(packageJson)\n packageJsonData.name = `${packageJsonData.name}-test`\n await writeFile(packageJsonPath, JSON.stringify(packageJsonData, null, 2))\n\n // Run pnpm install --no-lockfile in the temp directory\n try {\n const ignoreWsFlag = ignoreWorkspace ? ' --ignore-workspace' : ''\n // Disable pnpm's minimumReleaseAge for fixture installs. With\n // `--ignore-workspace`, the workspace's `minimumReleaseAgeExclude` list\n // is not applied, which can reject freshly-published Sanity versions\n // pinned in fixture package.json files.\n await exec(\n `pnpm install --prefer-offline --no-lockfile --config.minimum-release-age=0${ignoreWsFlag}`,\n {cwd: toPath},\n )\n } catch (error) {\n const execError = error as {message: string; stderr?: string; stdout?: string}\n spinner.fail('Failed to install dependencies')\n console.error(execError.stderr || execError.stdout || execError.message)\n throw new Error(\n `Error installing dependencies in ${toPath}: ${execError.stderr || execError.stdout || execError.message}`,\n {cause: error},\n )\n }\n }\n\n spinner.succeed('Test environment initialized')\n } catch (error) {\n spinner.fail('Failed to initialize test environment')\n throw error\n }\n}\n\n/**\n * Options for teardownTestFixtures\n *\n * @public\n */\nexport interface TeardownTestFixturesOptions {\n /**\n * Custom temp directory path. Defaults to process.cwd()/tmp\n */\n tempDir?: string\n}\n\n/**\n * Teardown function to clean up test fixtures.\n *\n * Removes the temp directory created by setupTestFixtures.\n *\n * This function is designed to be used with vitest globalSetup.\n *\n * @public\n *\n * @param options - Configuration options\n */\nexport async function teardown(options: TeardownTestFixturesOptions = {}): Promise<void> {\n const {tempDir} = options\n const tempDirectory = getTempPath(tempDir)\n\n // Remove the tmp directory\n await rm(tempDirectory, {force: true, maxRetries: 3, recursive: true}).catch(() => {})\n}\n"],"names":["exec","execNode","readFile","rm","writeFile","basename","join","promisify","ora","glob","fileExists","getFixturesPath","getTempPath","DEFAULT_FIXTURES","testCopyDirectory","getAdditionalFixturePaths","fixtures","paths","absolute","ignore","onlyDirectories","additionalFixtures","path","push","fixture","fromPath","includeDist","setup","_","options","ignoreWorkspace","tempDir","spinner","discardStdin","text","start","fixturesDir","tempDirectory","allFixturePaths","Object","entries","length","additionalFixturePaths","warn","toPath","packageJsonPath","packageJson","packageJsonData","JSON","parse","name","stringify","ignoreWsFlag","cwd","error","execError","fail","console","stderr","stdout","message","Error","cause","succeed","teardown","force","maxRetries","recursive","catch"],"mappings":"AAAA,SAAQA,QAAQC,QAAQ,QAAO,qBAAoB;AACnD,SAAQC,QAAQ,EAAEC,EAAE,EAAEC,SAAS,QAAO,mBAAkB;AACxD,SAAQC,QAAQ,EAAEC,IAAI,QAAO,YAAW;AACxC,SAAQC,SAAS,QAAO,YAAW;AAEnC,OAAOC,SAAS,MAAK;AACrB,SAAQC,IAAI,QAAO,aAAY;AAG/B,SAAQC,UAAU,QAAO,yBAAwB;AACjD,SAAQC,eAAe,EAAEC,WAAW,QAAO,oBAAmB;AAC9D,SAAQC,gBAAgB,QAAO,iBAAgB;AAC/C,SAAQC,iBAAiB,QAAO,mBAAkB;AAElD,MAAMd,OAAOO,UAAUN;AAmCvB,eAAec,0BAA0BC,QAAkB;IACzD,MAAMC,QAAQ,MAAMR,KAAKO,UAAU;QACjCE,UAAU;QACVC,QAAQ;YAAC;YAAsB;SAAa;QAC5CC,iBAAiB;IACnB;IAEA,MAAMC,qBAAuC,EAAE;IAE/C,KAAK,MAAMC,QAAQL,MAAO;QACxB,IAAI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O;AACtF"}
|
|
1
|
+
{"version":3,"sources":["../../src/test/setupFixtures.ts"],"sourcesContent":["import {exec as execNode} from 'node:child_process'\nimport {readFile, rm, writeFile} from 'node:fs/promises'\nimport {basename, join} from 'node:path'\nimport {promisify} from 'node:util'\n\nimport {glob} from 'tinyglobby'\nimport {type TestProject} from 'vitest/node'\n\nimport {fileExists} from '../utils/fileExists.js'\nimport {getFixturesPath, getTempPath} from '../utils/paths.js'\nimport {DEFAULT_FIXTURES} from './constants.js'\nimport {testCopyDirectory} from './testFixture.js'\n\nconst exec = promisify(execNode)\n\n/**\n * Options for setupTestFixtures\n *\n * @public\n */\nexport interface SetupTestFixturesOptions {\n /**\n * Glob patterns for additional fixture directories to set up.\n *\n * Each pattern is matched against directories in the current working directory.\n * Only directories containing a `package.json` file are included.\n *\n * @example\n * ```typescript\n * ['fixtures/*', 'dev/*']\n * ```\n */\n additionalFixtures?: string[]\n\n /**\n * When true, passes `--ignore-workspace` to pnpm install so fixtures get\n * their own node_modules even when the temp directory is inside a pnpm\n * workspace. Required for E2E tests that spawn the CLI binary against\n * fixture directories.\n */\n ignoreWorkspace?: boolean\n\n /**\n * Custom temp directory path. Defaults to process.cwd()/tmp\n */\n tempDir?: string\n}\n\nasync function getAdditionalFixturePaths(fixtures: string[]): Promise<FixtureDetails[]> {\n const paths = await glob(fixtures, {\n absolute: true,\n ignore: ['**/node_modules/**', '**/dist/**'],\n onlyDirectories: true,\n })\n\n const additionalFixtures: FixtureDetails[] = []\n\n for (const path of paths) {\n if (await fileExists(join(`${path}/package.json`))) {\n additionalFixtures.push({\n fixture: basename(path),\n fromPath: path,\n includeDist: false,\n })\n }\n }\n\n return additionalFixtures\n}\n\ninterface FixtureDetails {\n fixture: string\n fromPath: string\n includeDist: boolean\n}\n\n/**\n * Global setup function for initializing test fixtures.\n *\n * Copies fixtures from the bundled location to a temp directory\n * and installs dependencies.\n *\n * Note: Fixtures are NOT built during setup. Tests that need built\n * fixtures should build them as part of the test.\n *\n * This function is designed to be used with vitest globalSetup.\n *\n * @public\n *\n * @param options - Configuration options\n * @example\n * ```typescript\n * // In vitest.config.ts\n * export default defineConfig({\n * test: {\n * globalSetup: ['@sanity/cli-test/vitest']\n * }\n * })\n * ```\n */\nexport async function setup(_: TestProject, options: SetupTestFixturesOptions = {}): Promise<void> {\n const {additionalFixtures, ignoreWorkspace, tempDir} = options\n console.log('Initializing test environment...')\n const timerLabel = 'Test environment initialization'\n console.time(timerLabel)\n\n try {\n const fixturesDir = getFixturesPath()\n const tempDirectory = getTempPath(tempDir)\n\n const allFixturePaths: FixtureDetails[] = []\n\n // Add the default fixtures\n for (const [fixture, options] of Object.entries(DEFAULT_FIXTURES)) {\n allFixturePaths.push({\n fixture,\n fromPath: join(fixturesDir, fixture),\n includeDist: 'includeDist' in options && options.includeDist ? options.includeDist : false,\n })\n }\n\n // Add the additional fixtures\n if (additionalFixtures && additionalFixtures.length > 0) {\n const additionalFixturePaths = await getAdditionalFixturePaths(additionalFixtures)\n\n if (additionalFixturePaths.length > 0) {\n allFixturePaths.push(...additionalFixturePaths)\n } else {\n console.warn(\n `No additional fixtures found, check the glob pattern: ${additionalFixtures.join(', ')}`,\n )\n }\n }\n\n for (const {fixture, fromPath, includeDist} of allFixturePaths) {\n const toPath = join(tempDirectory, `fixture-${fixture}`)\n // Copy the fixture, excluding node_modules and dist\n await testCopyDirectory(fromPath, toPath, ['node_modules', ...(includeDist ? [] : ['dist'])])\n\n // Replace the package.json name with a temp name\n const packageJsonPath = join(toPath, 'package.json')\n const packageJson = await readFile(packageJsonPath, 'utf8')\n const packageJsonData = JSON.parse(packageJson)\n packageJsonData.name = `${packageJsonData.name}-test`\n await writeFile(packageJsonPath, JSON.stringify(packageJsonData, null, 2))\n\n // Run pnpm install --no-lockfile in the temp directory\n try {\n const ignoreWsFlag = ignoreWorkspace ? ' --ignore-workspace' : ''\n // Disable pnpm's minimumReleaseAge for fixture installs. With\n // `--ignore-workspace`, the workspace's `minimumReleaseAgeExclude` list\n // is not applied, which can reject freshly-published Sanity versions\n // pinned in fixture package.json files.\n await exec(\n `pnpm install --prefer-offline --no-lockfile --config.minimum-release-age=0${ignoreWsFlag}`,\n {cwd: toPath},\n )\n } catch (error) {\n const execError = error as {message: string; stderr?: string; stdout?: string}\n console.error('Failed to install dependencies')\n console.error(execError.stderr || execError.stdout || execError.message)\n throw new Error(\n `Error installing dependencies in ${toPath}: ${execError.stderr || execError.stdout || execError.message}`,\n {cause: error},\n )\n }\n }\n } catch (error) {\n console.error('Failed to initialize test environment!')\n throw error\n } finally {\n console.timeEnd(timerLabel)\n }\n}\n\n/**\n * Options for teardownTestFixtures\n *\n * @public\n */\nexport interface TeardownTestFixturesOptions {\n /**\n * Custom temp directory path. Defaults to process.cwd()/tmp\n */\n tempDir?: string\n}\n\n/**\n * Teardown function to clean up test fixtures.\n *\n * Removes the temp directory created by setupTestFixtures.\n *\n * This function is designed to be used with vitest globalSetup.\n *\n * @public\n *\n * @param options - Configuration options\n */\nexport async function teardown(options: TeardownTestFixturesOptions = {}): Promise<void> {\n const {tempDir} = options\n const tempDirectory = getTempPath(tempDir)\n\n // Remove the tmp directory\n await rm(tempDirectory, {force: true, maxRetries: 3, recursive: true}).catch(() => {})\n}\n"],"names":["exec","execNode","readFile","rm","writeFile","basename","join","promisify","glob","fileExists","getFixturesPath","getTempPath","DEFAULT_FIXTURES","testCopyDirectory","getAdditionalFixturePaths","fixtures","paths","absolute","ignore","onlyDirectories","additionalFixtures","path","push","fixture","fromPath","includeDist","setup","_","options","ignoreWorkspace","tempDir","console","log","timerLabel","time","fixturesDir","tempDirectory","allFixturePaths","Object","entries","length","additionalFixturePaths","warn","toPath","packageJsonPath","packageJson","packageJsonData","JSON","parse","name","stringify","ignoreWsFlag","cwd","error","execError","stderr","stdout","message","Error","cause","timeEnd","teardown","force","maxRetries","recursive","catch"],"mappings":"AAAA,SAAQA,QAAQC,QAAQ,QAAO,qBAAoB;AACnD,SAAQC,QAAQ,EAAEC,EAAE,EAAEC,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C,MACR,CAAC,iCAAiC,EAAEf,OAAO,EAAE,EAAEW,UAAUC,MAAM,IAAID,UAAUE,MAAM,IAAIF,UAAUG,OAAO,EAAE,EAC1G;oBAACE,OAAON;gBAAK;YAEjB;QACF;IACF,EAAE,OAAOA,OAAO;QACdtB,QAAQsB,KAAK,CAAC;QACd,MAAMA;IACR,SAAU;QACRtB,QAAQ6B,OAAO,CAAC3B;IAClB;AACF;AAcA;;;;;;;;;;CAUC,GACD,OAAO,eAAe4B,SAASjC,UAAuC,CAAC,CAAC;IACtE,MAAM,EAACE,OAAO,EAAC,GAAGF;IAClB,MAAMQ,gBAAgBzB,YAAYmB;IAElC,2BAA2B;IAC3B,MAAM3B,GAAGiC,eAAe;QAAC0B,OAAO;QAAMC,YAAY;QAAGC,WAAW;IAAI,GAAGC,KAAK,CAAC,KAAO;AACtF"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { CLITelemetryStore } from "@sanity/cli-core/types";
|
|
2
|
+
import { Mock } from "vitest";
|
|
3
|
+
import { SpinnerInstance } from "@sanity/cli-core/ux";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a mock HTTP server for testing.
|
|
7
|
+
*
|
|
8
|
+
* @returns A mock HTTP server object with emit and once methods
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function createMockHttpServer(): {
|
|
12
|
+
emit(event: string, ...args: unknown[]): void;
|
|
13
|
+
once(event: string, listener: (...args: unknown[]) => void): void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates a mock spinner function to avoid writing output to stdout.
|
|
18
|
+
* @param overrides - Pass any mocks or stubs for test expectations
|
|
19
|
+
* @internal
|
|
20
|
+
* @deprecated Use mocks/cli-core/ux/spinner instead
|
|
21
|
+
*/
|
|
22
|
+
export declare function createMockSpinner(
|
|
23
|
+
overrides?: Partial<SpinnerInstance>,
|
|
24
|
+
): Mock<(options: string) => SpinnerInstance>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a mock Vite watcher for testing.
|
|
28
|
+
*
|
|
29
|
+
* @returns A mock watcher object with add, emit, and on methods
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare function createMockWatcher(): MockWatcher;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates a test token for the Sanity CLI
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*
|
|
39
|
+
* @param token - The token to create
|
|
40
|
+
* @returns void
|
|
41
|
+
*/
|
|
42
|
+
export declare function createTestToken(token: string): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Default fixtures bundled with the package and their options.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export declare const DEFAULT_FIXTURES: Record<FixtureName, FixtureOptions>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use {@link FixtureName} instead. This type alias will be removed in a future release.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare type ExampleName = FixtureName;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Valid fixture name type.
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export declare type FixtureName =
|
|
62
|
+
| "basic-app"
|
|
63
|
+
| "basic-functions"
|
|
64
|
+
| "basic-studio"
|
|
65
|
+
| "federated-studio"
|
|
66
|
+
| "graphql-studio"
|
|
67
|
+
| "multi-workspace-studio"
|
|
68
|
+
| "nextjs-app"
|
|
69
|
+
| "prebuilt-app"
|
|
70
|
+
| "prebuilt-studio"
|
|
71
|
+
| "worst-case-studio";
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Options for each fixture.
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
export declare interface FixtureOptions {
|
|
78
|
+
includeDist?: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @public
|
|
83
|
+
* @param options - Options for mocking the telemetry store.
|
|
84
|
+
* @returns The mocked telemetry store.
|
|
85
|
+
*/
|
|
86
|
+
export declare const mockTelemetry: (
|
|
87
|
+
options?: MockTelemetryOptions,
|
|
88
|
+
) => CLITelemetryStore;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
export declare interface MockTelemetryOptions {
|
|
94
|
+
trace?: () => void;
|
|
95
|
+
updateUserProperties?: () => void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
export declare interface MockWatcher {
|
|
102
|
+
add: Mock;
|
|
103
|
+
emit: (event: string, ...args: unknown[]) => void;
|
|
104
|
+
on: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Serializer for snapshot tests to normalize line endings and Windows ^ to Unix `\`
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export declare const snapshotSerializer: {
|
|
112
|
+
serialize: (val: string) => string;
|
|
113
|
+
test: (val: unknown) => val is string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Recursively copy a directory, skipping specified folders.
|
|
118
|
+
*
|
|
119
|
+
* @param srcDir - Source directory to copy from
|
|
120
|
+
* @param destDir - Destination directory to copy to
|
|
121
|
+
* @param skip - Array of directory/file names to skip (e.g., ['node_modules', 'dist'])
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
export declare function testCopyDirectory(
|
|
125
|
+
srcDir: string,
|
|
126
|
+
destDir: string,
|
|
127
|
+
skip?: string[],
|
|
128
|
+
): Promise<void>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated Use {@link testFixture} instead. This function will be removed in a future release.
|
|
132
|
+
*
|
|
133
|
+
* Clones an example (now called fixture) directory into a temporary directory with an isolated copy.
|
|
134
|
+
*
|
|
135
|
+
* @param exampleName - The name of the example/fixture to clone (e.g., 'basic-app', 'basic-studio')
|
|
136
|
+
* @param options - Configuration options
|
|
137
|
+
* @returns The absolute path to the temporary directory containing the example/fixture
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
export declare function testExample(
|
|
142
|
+
exampleName: FixtureName | (string & {}),
|
|
143
|
+
options?: TestFixtureOptions,
|
|
144
|
+
): Promise<string>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated Use {@link TestFixtureOptions} instead. This type alias will be removed in a future release.
|
|
148
|
+
* @public
|
|
149
|
+
*/
|
|
150
|
+
export declare type TestExampleOptions = TestFixtureOptions;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Clones a fixture directory into a temporary directory with an isolated copy.
|
|
154
|
+
*
|
|
155
|
+
* The function creates a unique temporary copy of the specified fixture with:
|
|
156
|
+
* - A random unique ID to avoid conflicts between parallel tests
|
|
157
|
+
* - Symlinked node_modules for performance (from the global setup version)
|
|
158
|
+
* - Modified package.json name to prevent conflicts
|
|
159
|
+
*
|
|
160
|
+
* The fixture is first looked up in the temp directory (if global setup ran),
|
|
161
|
+
* otherwise it falls back to the bundled fixtures in the package.
|
|
162
|
+
*
|
|
163
|
+
* @param fixtureName - The name of the fixture to clone (e.g., 'basic-app', 'basic-studio')
|
|
164
|
+
* @param options - Configuration options
|
|
165
|
+
* @returns The absolute path to the temporary directory containing the fixture
|
|
166
|
+
*
|
|
167
|
+
* @public
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* import {testFixture} from '@sanity/cli-test'
|
|
172
|
+
* import {describe, test} from 'vitest'
|
|
173
|
+
*
|
|
174
|
+
* describe('my test suite', () => {
|
|
175
|
+
* test('should work with basic-studio', async () => {
|
|
176
|
+
* const cwd = await testFixture('basic-studio')
|
|
177
|
+
* // ... run your tests in this directory
|
|
178
|
+
* })
|
|
179
|
+
* })
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export declare function testFixture(
|
|
183
|
+
fixtureName: FixtureName | (string & {}),
|
|
184
|
+
options?: TestFixtureOptions,
|
|
185
|
+
): Promise<string>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
export declare interface TestFixtureOptions {
|
|
191
|
+
/**
|
|
192
|
+
* Custom temp directory. Defaults to process.cwd()/tmp (or the OS temp directory when
|
|
193
|
+
* `useSystemTmp` is true).
|
|
194
|
+
*/
|
|
195
|
+
tempDir?: string;
|
|
196
|
+
/**
|
|
197
|
+
* Use the OS temp directory instead of cwd/tmp. Avoids monorepo workspace detection by
|
|
198
|
+
* package managers and git when tests run inside a monorepo. Ignored when `tempDir` is set.
|
|
199
|
+
*/
|
|
200
|
+
useSystemTmp?: boolean;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Fast, in-memory export of utilities provided by cli-test. Limit transient dependencies (no OCLIF, no nock, etc.). Dedicated exports for test utilities relying on heavy exports already exist (e.g. test/createTestClient, test/mockApi, test/oclif, test/setupFixtures, etc.)
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export * from './createMockHttpServer.js';
|
|
4
|
+
export * from './createMockSpinner.js';
|
|
5
|
+
export * from './createMockWatcher.js';
|
|
6
|
+
export * from './createTestToken.js';
|
|
7
|
+
export * from './mockTelemetry.js';
|
|
8
|
+
export * from './snapshotSerializer.js';
|
|
9
|
+
export * from './testFixture.js';
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test/util.ts"],"sourcesContent":["// Fast, in-memory export of utilities provided by cli-test. Limit transient dependencies (no OCLIF, no nock, etc.). Dedicated exports for test utilities relying on heavy exports already exist (e.g. test/createTestClient, test/mockApi, test/oclif, test/setupFixtures, etc.)\nexport * from './constants.js'\nexport * from './createMockHttpServer.js'\nexport * from './createMockSpinner.js'\nexport * from './createMockWatcher.js'\nexport * from './createTestToken.js'\nexport * from './mockTelemetry.js'\nexport * from './snapshotSerializer.js'\nexport * from './testFixture.js'\n"],"names":[],"mappings":"AAAA,iRAAiR;AACjR,cAAc,iBAAgB;AAC9B,cAAc,4BAA2B;AACzC,cAAc,yBAAwB;AACtC,cAAc,yBAAwB;AACtC,cAAc,uBAAsB;AACpC,cAAc,qBAAoB;AAClC,cAAc,0BAAyB;AACvC,cAAc,mBAAkB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts Unix-style paths to platform-appropriate paths.
|
|
3
|
+
* On Windows:
|
|
4
|
+
* - Absolute paths starting with '/': adds drive letter and converts to backslashes
|
|
5
|
+
* - Relative/partial paths: converts forward slashes to backslashes
|
|
6
|
+
* On Unix: keeps paths as-is.
|
|
7
|
+
*
|
|
8
|
+
* @param pathStr - Unix-style path (e.g., '/test/path' or '.config/file.json')
|
|
9
|
+
* @returns Platform-appropriate path
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function convertToSystemPath(pathStr: string): string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a unique temporary directory for test output.
|
|
16
|
+
* Uses {@link getTempPath} as the base, creating it if needed.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Configuration options: `prefix` (default: 'cli-e2e-') and
|
|
19
|
+
* `useSystemTmp` (default: false) which uses the OS temp directory instead of
|
|
20
|
+
* cwd/tmp to avoid monorepo workspace detection by package managers and git.
|
|
21
|
+
* @returns The path and a cleanup function
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare function createTmpDir(options?: {
|
|
25
|
+
prefix?: string;
|
|
26
|
+
useSystemTmp?: boolean;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
cleanup: () => Promise<void>;
|
|
29
|
+
path: string;
|
|
30
|
+
}>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Gets the current Windows drive letter from process.cwd().
|
|
34
|
+
* Falls back to 'C:\\' if detection fails.
|
|
35
|
+
*
|
|
36
|
+
* @returns Drive letter with backslash (e.g., 'C:\\', 'D:\\') or empty string on Unix
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare function getCurrentDrive(): string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Gets the path to the fixtures directory bundled with this package.
|
|
43
|
+
*
|
|
44
|
+
* The fixtures are copied during build and bundled with the published package.
|
|
45
|
+
* This function works the same whether the package is used in a monorepo
|
|
46
|
+
* or installed from npm.
|
|
47
|
+
*
|
|
48
|
+
* @returns Absolute path to the fixtures directory
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function getFixturesPath(): string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Gets the path to the temporary directory for test fixtures.
|
|
55
|
+
*
|
|
56
|
+
* Uses the initial working directory captured when this module was first loaded,
|
|
57
|
+
* not process.cwd() which may change during test execution.
|
|
58
|
+
*
|
|
59
|
+
* @param customTempDir - Optional custom temp directory path
|
|
60
|
+
* @returns Absolute path to temp directory (default: initial cwd/tmp)
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export declare function getTempPath(customTempDir?: string): string;
|
|
64
|
+
|
|
65
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli-test",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Sanity CLI test helpers and utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -33,6 +33,66 @@
|
|
|
33
33
|
"source": "./src/index.ts",
|
|
34
34
|
"default": "./dist/index.js"
|
|
35
35
|
},
|
|
36
|
+
"./mocks/cli-core/apiClient": {
|
|
37
|
+
"source": "./src/mocks/cli-core/apiClient.ts",
|
|
38
|
+
"default": "./dist/mocks/cli-core/apiClient.js"
|
|
39
|
+
},
|
|
40
|
+
"./mocks/cli-core/browser": {
|
|
41
|
+
"source": "./src/mocks/cli-core/browser.ts",
|
|
42
|
+
"default": "./dist/mocks/cli-core/browser.js"
|
|
43
|
+
},
|
|
44
|
+
"./mocks/cli-core/config": {
|
|
45
|
+
"source": "./src/mocks/cli-core/config.ts",
|
|
46
|
+
"default": "./dist/mocks/cli-core/config.js"
|
|
47
|
+
},
|
|
48
|
+
"./mocks/cli-core/package-manager": {
|
|
49
|
+
"source": "./src/mocks/cli-core/package-manager.ts",
|
|
50
|
+
"default": "./dist/mocks/cli-core/package-manager.js"
|
|
51
|
+
},
|
|
52
|
+
"./mocks/cli-core/request": {
|
|
53
|
+
"source": "./src/mocks/cli-core/request.ts",
|
|
54
|
+
"default": "./dist/mocks/cli-core/request.js"
|
|
55
|
+
},
|
|
56
|
+
"./mocks/cli-core/tasks": {
|
|
57
|
+
"source": "./src/mocks/cli-core/tasks.ts",
|
|
58
|
+
"default": "./dist/mocks/cli-core/tasks.js"
|
|
59
|
+
},
|
|
60
|
+
"./mocks/cli-core/telemetry": {
|
|
61
|
+
"source": "./src/mocks/cli-core/telemetry.ts",
|
|
62
|
+
"default": "./dist/mocks/cli-core/telemetry.js"
|
|
63
|
+
},
|
|
64
|
+
"./mocks/cli-core/ux": {
|
|
65
|
+
"source": "./src/mocks/cli-core/ux.ts",
|
|
66
|
+
"default": "./dist/mocks/cli-core/ux.js"
|
|
67
|
+
},
|
|
68
|
+
"./mocks/cli-core/SanityCommand": {
|
|
69
|
+
"source": "./src/mocks/cli-core/SanityCommand.ts",
|
|
70
|
+
"default": "./dist/mocks/cli-core/SanityCommand.js"
|
|
71
|
+
},
|
|
72
|
+
"./paths": {
|
|
73
|
+
"source": "./src/utils/paths.ts",
|
|
74
|
+
"default": "./dist/utils/paths.js"
|
|
75
|
+
},
|
|
76
|
+
"./test/createTestClient": {
|
|
77
|
+
"source": "./src/test/createTestClient.ts",
|
|
78
|
+
"default": "./dist/test/createTestClient.js"
|
|
79
|
+
},
|
|
80
|
+
"./test/mockApi": {
|
|
81
|
+
"source": "./src/test/mockApi.ts",
|
|
82
|
+
"default": "./dist/test/mockApi.js"
|
|
83
|
+
},
|
|
84
|
+
"./test/oclif": {
|
|
85
|
+
"source": "./src/test/oclif.ts",
|
|
86
|
+
"default": "./dist/test/oclif.js"
|
|
87
|
+
},
|
|
88
|
+
"./test/setupFixtures": {
|
|
89
|
+
"source": "./src/test/setupFixtures.ts",
|
|
90
|
+
"default": "./dist/test/setupFixtures.js"
|
|
91
|
+
},
|
|
92
|
+
"./test/util": {
|
|
93
|
+
"source": "./src/test/util.ts",
|
|
94
|
+
"default": "./dist/test/util.js"
|
|
95
|
+
},
|
|
36
96
|
"./vitest": {
|
|
37
97
|
"source": "./src/vitest.ts",
|
|
38
98
|
"default": "./dist/vitest.js"
|
|
@@ -47,9 +107,8 @@
|
|
|
47
107
|
"ansis": "^4.2.0",
|
|
48
108
|
"esbuild": "^0.28.1",
|
|
49
109
|
"nock": "^14.0.15",
|
|
50
|
-
"ora": "^9.0.0",
|
|
51
110
|
"tinyglobby": "^0.2.17",
|
|
52
|
-
"@sanity/cli-core": "2.
|
|
111
|
+
"@sanity/cli-core": "2.3.0"
|
|
53
112
|
},
|
|
54
113
|
"devDependencies": {
|
|
55
114
|
"@eslint/compat": "^2.1.0",
|
|
@@ -73,7 +132,7 @@
|
|
|
73
132
|
"@oclif/core": "^4.0.0",
|
|
74
133
|
"@sanity/client": "^7.0.0",
|
|
75
134
|
"vitest": ">=3.0.0 <5.0.0",
|
|
76
|
-
"@sanity/cli-core": "2.
|
|
135
|
+
"@sanity/cli-core": "2.3.0"
|
|
77
136
|
},
|
|
78
137
|
"engines": {
|
|
79
138
|
"node": ">=22.12"
|