dts-jest
Version:
A preprocessor for Jest to snapshot test TypeScript declaration (.d.ts) files
125 lines (124 loc) • 3.16 kB
TypeScript
import * as _ts from 'typescript';
export declare const package_name: any;
export declare const package_homepage: any;
export declare const package_remap_bin: string;
export declare const config_namespace = "_dts_jest_";
export declare const runtime_namespace = "_dts_jest_runtime_";
export declare const env_root_dir = "DTS_JEST_ROOT_DIR";
export declare const runtime_indent_spaces = 2;
export declare const docblock_option_regex: RegExp;
export declare enum DocblockOptionMatchIndex {
Input = 0,
Options = 1
}
export declare enum DocblockOptionValue {
EnableTestType = "enable:test-type",
EnableTestValue = "enable:test-value",
DisableTestType = "disable:test-type",
DisableTestValue = "disable:test-value"
}
export interface DocblockOptions {
test_type?: boolean;
test_value?: boolean;
}
export declare const trigger_header_regex: RegExp;
export declare enum TriggerHeaderMatchIndex {
Input = 0,
Flags = 1,
Description = 2
}
export declare const trigger_footer_regex: RegExp;
export declare enum TriggerFooterMatchIndex {
Input = 0,
Value = 1
}
export declare enum TriggerHeaderFlags {
None = 0,
':snap' = 1,
':show' = 2,
':pass' = 4,
':fail' = 8,
':only' = 16,
':skip' = 32,
':group' = 64,
':not-any' = 128,
Assertion = 143
}
export declare enum TriggerFooterFlag {
Show = "?",
Error = ":error",
NoError = ":no-error"
}
export declare enum TestMethod {
Test = "test",
Only = "test.only",
Skip = "test.skip"
}
export declare enum GroupMethod {
Test = "describe",
Only = "describe.only",
Skip = "describe.skip"
}
export interface TriggerHeader {
line: number;
flags: TriggerHeaderFlags;
method: TestMethod;
description?: string;
group?: TriggerGroup;
}
export interface TriggerBody {
start: number;
end: number;
/**
* raw expression text without trailing semicolon
*/
text: string;
/**
* one line expression text without trailing semicolon
*/
experssion: string;
}
export interface TriggerFooter {
line: number;
flag?: TriggerFooterFlag;
expected?: string;
}
export interface Trigger {
header: TriggerHeader;
body: TriggerBody;
footer?: TriggerFooter;
}
export interface TriggerGroup {
line: number;
method: GroupMethod;
description?: string;
}
export interface Snapshot {
line: number;
inference?: string;
diagnostic?: string;
}
export interface JestConfig {
rootDir: string;
globals: {
[K in typeof config_namespace]?: RawConfig;
};
}
export interface RawConfig extends DocblockOptions {
compiler_options?: string | Record<string, any>;
enclosing_declaration?: boolean;
type_format_flags?: _ts.TypeFormatFlags;
typescript?: string;
transpile?: boolean;
}
export interface NormalizedConfig {
test_type: boolean;
test_value: boolean;
compiler_options: _ts.CompilerOptions;
file_names: string[];
enclosing_declaration: boolean;
type_format_flags: _ts.TypeFormatFlags;
typescript: typeof _ts;
typescript_path: string;
transpile: boolean;
}