UNPKG

1.83 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="vinyl-fs" />
3import urlMod from "url";
4import { GetText } from "./get-text";
5import { Reporter } from "./reporter";
6import { RichProcessCov } from "./spawn-inspected";
7interface Watermarks {
8 lines: [number, number];
9 functions: [number, number];
10 branches: [number, number];
11 statements: [number, number];
12}
13export interface FileConfig {
14 reporters?: ReadonlyArray<string>;
15 globs?: ReadonlyArray<string>;
16 coverageDir?: string;
17 waterMarks?: Watermarks;
18}
19export interface CliConfig {
20 reporters?: ReadonlyArray<string>;
21 globs?: ReadonlyArray<string>;
22 coverageDir?: string;
23 command: ReadonlyArray<string>;
24}
25export interface ResolvedConfig {
26 reporters: ReadonlyArray<string>;
27 globs: ReadonlyArray<string>;
28 coverageDir: string;
29 waterMarks: Watermarks;
30 command: ReadonlyArray<string>;
31}
32export interface MessageAction {
33 action: "message";
34 message: string;
35 error?: Error;
36}
37export interface RunAction {
38 action: "run";
39 config: ResolvedConfig;
40}
41export declare type CliAction = MessageAction | RunAction;
42export declare type ParseArgsResult = MessageAction | {
43 action: "run";
44 config: CliConfig;
45};
46/**
47 * Executes the c88 CLI
48 *
49 * @param args CLI arguments
50 * @param cwd Current working directory
51 * @param proc Current process
52 */
53export declare function execCli(args: string[], cwd: string, proc: NodeJS.Process): Promise<number>;
54export declare function report(reporter: Reporter, processCovs: ReadonlyArray<RichProcessCov>, outStream: NodeJS.WritableStream, outDir: Readonly<urlMod.URL>, getText?: GetText): Promise<void>;
55export declare function getAction(args: string[], cwd: string): Promise<CliAction>;
56export declare function parseArgs(args: string[]): ParseArgsResult;
57export {};