intern
Version:
Intern. A next-generation code testing stack for JavaScript.
35 lines (34 loc) • 1.92 kB
TypeScript
import { CancellablePromise } from '@theintern/common';
import { Config } from './config';
import { Executor } from '../executors/Executor';
import { InternError } from '../types';
export interface EvaluatedProperty {
name: keyof Config;
addToExisting: boolean;
}
export interface TextLoader {
(path: string): CancellablePromise<string>;
}
export declare type TypeName = 'string' | 'boolean' | 'number' | 'regexp' | 'object' | 'string[]' | 'object[]';
export declare type Parser<T = any> = (value: any) => T;
export declare function evalProperty<C>(key: keyof C): EvaluatedProperty;
export declare function getBasePath(configFile: string, basePath: string, isAbsolute: (path: string) => boolean, pathSep?: string): string;
export declare function getConfigDescription(config: any, prefix?: string): string;
export declare function loadConfig(configPath: string, loadText: TextLoader, args?: {
[key: string]: any;
}, childConfig?: string | string[]): CancellablePromise<any>;
export declare function parseArgs(rawArgs: string[]): {
[key: string]: any;
};
export declare function parseJson(json: string): any;
export declare function parseValue(name: string, value: any, parser: TypeName | Parser, requiredProperty?: string): any;
export declare function prefix(message: string, prefix: string): string;
export declare function processOption<C extends Config>(key: keyof C, value: any, config: C, executor?: Executor): void;
export declare function pullFromArray<T>(haystack: T[], needle: T): T[];
export declare function setOption(config: Config, name: keyof Config, value: any, addToExisting?: boolean): void;
export declare function splitConfigPath(path: string, separator?: string): {
configFile: string;
childConfig?: string;
};
export declare function stringify(object: Object, indent?: string): string;
export declare function errorToJSON(error?: InternError): InternError | undefined;