1 | declare namespace Mochawesome {
|
2 | interface ReporterOptions {
|
3 | quiet: boolean;
|
4 | code: boolean;
|
5 | "no-code": boolean;
|
6 | html: boolean;
|
7 | json: boolean;
|
8 | consoleReporter: string;
|
9 | reportFilename: string;
|
10 | }
|
11 |
|
12 | interface Options {
|
13 | inlineDiffs?: boolean | undefined;
|
14 | reporterOptions?: Partial<ReporterOptions> | undefined;
|
15 | }
|
16 |
|
17 | interface Config {
|
18 | quiet: boolean;
|
19 | reportFilename: string;
|
20 | saveHtml: boolean;
|
21 | saveJson: boolean;
|
22 | consoleReporter: string;
|
23 | useInlineDiffs: boolean;
|
24 | code: boolean;
|
25 | }
|
26 |
|
27 | interface Stats {
|
28 | testsRegistered: number;
|
29 | passPercent: number;
|
30 | pendingPercent: number;
|
31 | other: number;
|
32 | hasOther: boolean;
|
33 | skipped: number;
|
34 | hasSkipped: boolean;
|
35 | }
|
36 |
|
37 | |
38 |
|
39 |
|
40 | type OutputStats = Mocha.Stats & Stats;
|
41 |
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 | interface OutputMeta {
|
48 | mocha: {
|
49 | version: string;
|
50 | };
|
51 | mochawesome: {
|
52 | options: Config;
|
53 | version: string;
|
54 | };
|
55 | marge: {
|
56 | options: ReporterOptions;
|
57 | version: string;
|
58 | };
|
59 | }
|
60 |
|
61 | interface TestError {
|
62 | message: string;
|
63 | estack?: string | undefined;
|
64 | diff: string | string[];
|
65 | }
|
66 |
|
67 | |
68 |
|
69 |
|
70 |
|
71 | interface PlainTest {
|
72 | title: string;
|
73 | fullTitle: string;
|
74 | timedOut: boolean;
|
75 | pass: boolean;
|
76 | fail: boolean;
|
77 | pending: boolean;
|
78 | uuid: string;
|
79 | isHook: boolean;
|
80 | skipped: boolean;
|
81 | err: TestError | {};
|
82 |
|
83 | context?: string | undefined;
|
84 | speed?: "slow" | "medium" | "fast" | undefined;
|
85 | state?: "failed" | "passed" | undefined;
|
86 | duration?: number | undefined;
|
87 | code?: string | undefined;
|
88 | parentUUID?: string | undefined;
|
89 | }
|
90 |
|
91 | |
92 |
|
93 |
|
94 |
|
95 | interface PlainSuite {
|
96 | uuid: string;
|
97 | title: string;
|
98 | fullFile: string;
|
99 | file: string;
|
100 | beforeHooks: PlainTest[];
|
101 | afterHooks: PlainTest[];
|
102 | tests: PlainTest[];
|
103 | suites: PlainSuite[];
|
104 | passes: string[];
|
105 | failures: string[];
|
106 | pending: string[];
|
107 | skipped: string[];
|
108 | duration: number;
|
109 | root: boolean;
|
110 | rootEmpty: boolean;
|
111 | _timeout: number;
|
112 | }
|
113 |
|
114 | type OutputResults = PlainSuite[];
|
115 |
|
116 | interface Output {
|
117 | stats: OutputStats;
|
118 | results: OutputResults;
|
119 | meta: OutputMeta;
|
120 | }
|
121 |
|
122 | type ExitFunction = (code: number) => void;
|
123 |
|
124 | type Done = (failures: number, exit: ExitFunction) => Promise<void>;
|
125 | }
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | declare class Mochawesome {
|
133 | |
134 |
|
135 |
|
136 |
|
137 |
|
138 | constructor(runner: Mocha.Runner, options?: Mochawesome.Options);
|
139 |
|
140 | /**
|
141 | * The parsed configuration options for this
|
142 | * Mochawesome instance.
|
143 | */
|
144 | config: Mochawesome.Config;
|
145 |
|
146 | /**
|
147 | * Information related to the results of the test
|
148 | * suite ran by the supplied `Mocha.Runner` instance.
|
149 | * Will be populated after the suite is run.
|
150 | */
|
151 | output?: Mochawesome.Output | undefined;
|
152 |
|
153 | done: Mochawesome.Done;
|
154 | }
|
155 |
|
156 | export = Mochawesome;
|