diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-13 21:34:48 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-13 21:34:48 -0800 |
| commit | 76cb9c2a39d477a64824a985ade40507e3bbade1 (patch) | |
| tree | 41e997aa9c6f538d3a136af61dae9424db2005a9 /vanilla/node_modules/@vitest/utils/dist/helpers.d.ts | |
| parent | 819a39a21ac992b1393244a4c283bbb125208c69 (diff) | |
| download | neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.gz neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.bz2 neko-76cb9c2a39d477a64824a985ade40507e3bbade1.zip | |
feat(vanilla): add testing infrastructure and tests (NK-wjnczv)
Diffstat (limited to 'vanilla/node_modules/@vitest/utils/dist/helpers.d.ts')
| -rw-r--r-- | vanilla/node_modules/@vitest/utils/dist/helpers.d.ts | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/vanilla/node_modules/@vitest/utils/dist/helpers.d.ts b/vanilla/node_modules/@vitest/utils/dist/helpers.d.ts new file mode 100644 index 0000000..493817b --- /dev/null +++ b/vanilla/node_modules/@vitest/utils/dist/helpers.d.ts @@ -0,0 +1,73 @@ +import { Nullable, Arrayable } from './types.js'; + +declare function nanoid(size?: number): string; + +declare function shuffle<T>(array: T[], seed?: number): T[]; + +interface CloneOptions { + forceWritable?: boolean; +} +interface ErrorOptions { + message?: string; + stackTraceLimit?: number; +} + +/** +* Get original stacktrace without source map support the most performant way. +* - Create only 1 stack frame. +* - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms). +*/ +declare function createSimpleStackTrace(options?: ErrorOptions): string; +declare function notNullish<T>(v: T | null | undefined): v is NonNullable<T>; +declare function assertTypes(value: unknown, name: string, types: string[]): void; +declare function isPrimitive(value: unknown): boolean; +declare function slash(path: string): string; +declare function cleanUrl(url: string): string; +declare const isExternalUrl: (url: string) => boolean; +/** +* Prepend `/@id/` and replace null byte so the id is URL-safe. +* This is prepended to resolved ids that are not valid browser +* import specifiers by the importAnalysis plugin. +*/ +declare function wrapId(id: string): string; +/** +* Undo {@link wrapId}'s `/@id/` and null byte replacements. +*/ +declare function unwrapId(id: string): string; +declare function withTrailingSlash(path: string): string; +declare function isBareImport(id: string): boolean; +declare function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T>; +declare function isObject(item: unknown): boolean; +declare function getType(value: unknown): string; +declare function getOwnProperties(obj: any): (string | symbol)[]; +declare function deepClone<T>(val: T, options?: CloneOptions): T; +declare function clone<T>(val: T, seen: WeakMap<any, any>, options?: CloneOptions): T; +declare function noop(): void; +declare function objectAttr(source: any, path: string, defaultValue?: undefined): any; +type DeferPromise<T> = Promise<T> & { + resolve: (value: T | PromiseLike<T>) => void; + reject: (reason?: any) => void; +}; +declare function createDefer<T>(): DeferPromise<T>; +/** +* If code starts with a function call, will return its last index, respecting arguments. +* This will return 25 - last ending character of toMatch ")" +* Also works with callbacks +* ``` +* toMatch({ test: '123' }); +* toBeAliased('123') +* ``` +*/ +declare function getCallLastIndex(code: string): number | null; +declare function isNegativeNaN(val: number): boolean; +/** +* Deep merge :P +* +* Will merge objects only if they are plain +* +* Do not merge types - it is very expensive and usually it's better to case a type here +*/ +declare function deepMerge<T extends object = object>(target: T, ...sources: any[]): T; + +export { assertTypes, cleanUrl, clone, createDefer, createSimpleStackTrace, deepClone, deepMerge, getCallLastIndex, getOwnProperties, getType, isBareImport, isExternalUrl, isNegativeNaN, isObject, isPrimitive, nanoid, noop, notNullish, objectAttr, shuffle, slash, toArray, unwrapId, withTrailingSlash, wrapId }; +export type { DeferPromise }; |
