UNPKG

@sxzz/test-utils

Version:

Collection of common test utils.

42 lines (35 loc) 2.11 kB
import { GlobOptions } from 'tinyglobby'; import { RolldownPluginOption, InputOptions, OutputOptions, RolldownOutput, OutputChunk as OutputChunk$1, OutputAsset as OutputAsset$1 } from 'rolldown'; import { InputPluginOption, InputOptions as InputOptions$1, OutputOptions as OutputOptions$1, RollupOutput, Plugin, OutputChunk, OutputAsset } from 'rollup'; import { ExpectStatic } from 'vitest'; import { OutputFile } from 'esbuild'; type SkipFn = (testName: string) => boolean | Promise<boolean>; declare function testFixturesSkip(fn: SkipFn): void; interface FixtureOptions { params?: [name: string, values?: any[]][]; promise?: boolean; concurrent?: boolean; } declare function testFixtures(globs: string | string[], exec: (args: Record<string, any>, id: string) => any, options?: GlobOptions & FixtureOptions): Promise<void>; declare function testFixtures(files: Record<string, string>, exec: (args: Record<string, any>, id: string, code: string) => any, options?: FixtureOptions): Promise<void>; declare function rolldownBuild(file: string, plugins?: RolldownPluginOption, inputOptions?: InputOptions, outputOptions?: OutputOptions): Promise<{ chunks: RolldownOutput["output"] snapshot: string }>; declare function rollupBuild(file: string, plugins?: InputPluginOption, inputOptions?: InputOptions$1, outputOptions?: OutputOptions$1): Promise<{ chunks: RollupOutput["output"] snapshot: string }>; declare const RollupToStringPlugin: () => Plugin; declare const RollupEscapeNullCharacterPlugin: () => Plugin; declare function outputToSnapshot(chunks: (OutputChunk | OutputAsset | OutputChunk$1 | OutputAsset$1 | OutputFile)[]): string; declare function expectFilesSnapshot(sourceDir: string, snapshotFile: string, { pattern, expect }?: { pattern?: string expect?: ExpectStatic }): Promise<{ files: string[] fileMap: any snapshot: string }>; declare function removeSpaces(s: string): string; export { type FixtureOptions, RollupEscapeNullCharacterPlugin, RollupToStringPlugin, expectFilesSnapshot, outputToSnapshot, removeSpaces, rolldownBuild, rollupBuild, testFixtures, testFixturesSkip };