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