UNPKG

sv

Version:

A command line interface (CLI) for creating and maintaining Svelte applications

82 lines (81 loc) 2.65 kB
import { r as OptionMap, t as AddonMap } from "../engine-CtSoxta7.mjs"; import { Page } from "@playwright/test"; import { TestProject } from "vitest/node"; //#region src/testing.d.ts type ProjectVariant = "kit-js" | "kit-ts" | "vite-js" | "vite-ts"; declare const variants: ProjectVariant[]; type CreateProject = (options: { testId: string; variant: ProjectVariant; /** @default true */ clean?: boolean; }) => string; declare module "vitest" { interface ProvidedContext { testDir: string; templatesDir: string; variants: ProjectVariant[]; } } declare function setupGlobal({ TEST_DIR, pre, post }: { TEST_DIR: string; pre?: () => Promise<void>; post?: () => Promise<void>; }): ({ provide }: TestProject) => Promise<() => Promise<void>>; type Fixtures = { page: Page; cwd(addonTestCase: AddonTestCase<any>): string; }; type AddonTestCase<Addons extends AddonMap> = { variant: ProjectVariant; kind: { type: string; options: OptionMap<Addons>; }; }; type SetupTestOptions<Addons extends AddonMap> = { kinds: Array<AddonTestCase<Addons>["kind"]>; filter?: (addonTestCase: AddonTestCase<Addons>) => boolean; browser?: boolean; preAdd?: (o: { addonTestCase: AddonTestCase<Addons>; cwd: string; }) => Promise<void> | void; }; type PrepareServerOptions = { cwd: string; page: Page; buildCommand?: string; previewCommand?: string; /** * Vitest's `expect`, injected by `createSetupTest`. Used to make a Vitest-counted * assertion that the preview loaded, which also satisfies `requireAssertions` for * tests that otherwise only assert through Playwright's (untracked) `expect`. */ expect?: VitestContext["expect"]; }; type PrepareServerReturn = { url: string; close: () => Promise<void>; }; declare function prepareServer({ cwd, page, buildCommand, previewCommand, expect }: PrepareServerOptions): Promise<PrepareServerReturn>; type PlaywrightContext = Pick<typeof import("@playwright/test"), "chromium">; type VitestContext = Pick<typeof import("vitest"), "inject" | "test" | "beforeAll" | "beforeEach" | "expect">; declare function createSetupTest(vitest: VitestContext, playwright?: PlaywrightContext): <Addons extends AddonMap>(addons: Addons, options?: SetupTestOptions<Addons>) => { test: import("vitest").TestAPI<Fixtures>; testCases: Array<AddonTestCase<AddonMap>>; prepareServer: typeof prepareServer; }; //#endregion export { AddonTestCase, CreateProject, Fixtures, PlaywrightContext, PrepareServerOptions, PrepareServerReturn, ProjectVariant, SetupTestOptions, VitestContext, createSetupTest, prepareServer, setupGlobal, variants };