import { TestProject } from "vitest/node"; /** * Global setup function for initializing test fixtures. * * Copies fixtures from the bundled location to a temp directory * and installs dependencies. * * Note: Fixtures are NOT built during setup. Tests that need built * fixtures should build them as part of the test. * * This function is designed to be used with vitest globalSetup. * * @public * * @param options - Configuration options * @example * ```typescript * // In vitest.config.ts * export default defineConfig({ * test: { * globalSetup: ['@sanity/cli-test/vitest'] * } * }) * ``` */ export declare function setup( _: TestProject, options?: SetupTestFixturesOptions, ): Promise; /** * Options for setupTestFixtures * * @public */ declare interface SetupTestFixturesOptions { /** * Glob patterns for additional fixture directories to set up. * * Each pattern is matched against directories in the current working directory. * Only directories containing a `package.json` file are included. * * @example * ```typescript * ['fixtures/*', 'dev/*'] * ``` */ additionalFixtures?: string[]; /** * When true, passes `--ignore-workspace` to pnpm install so fixtures get * their own node_modules even when the temp directory is inside a pnpm * workspace. Required for E2E tests that spawn the CLI binary against * fixture directories. */ ignoreWorkspace?: boolean; /** * Custom temp directory path. Defaults to process.cwd()/tmp */ tempDir?: string; } /** * Setup function to build the worker files with esbuild. * * Bundles the worker files with esbuild and sets up watch mode if in watch mode. * All npm packages are automatically marked as external (loaded from node_modules at runtime). * Only internal project code is bundled inline. * * @public * * @param filePaths - The paths to the worker files to build * @returns A promise that resolves when the worker build is setup * @throws If the worker files cannot be bundled * @throws If the watcher cannot be set up */ export declare function setupWorkerBuild(filePaths: string[]): Promise; /** * Serializer for snapshot tests to normalize line endings and Windows ^ to Unix `\` * @public */ export declare const snapshotSerializer: { serialize: (val: string) => string; test: (val: unknown) => val is string; }; /** * Teardown function to clean up test fixtures. * * Removes the temp directory created by setupTestFixtures. * * This function is designed to be used with vitest globalSetup. * * @public * * @param options - Configuration options */ export declare function teardown( options?: TeardownTestFixturesOptions, ): Promise; /** * Options for teardownTestFixtures * * @public */ declare interface TeardownTestFixturesOptions { /** * Custom temp directory path. Defaults to process.cwd()/tmp */ tempDir?: string; } /** * Teardown function to clean up the worker build. * * Closes all build contexts and deletes the compiled JavaScript files. * * @public * * @returns A promise that resolves when the worker build is teared down * @throws If the build contexts cannot be disposed * @throws If the compiled JavaScript files cannot be deleted */ export declare function teardownWorkerBuild(): Promise; export {};