UNPKG

1.87 kBTypeScriptView Raw
1import type { Services, Options } from '@wdio/types';
2import type { MochaOpts as MochaOptsImport, FrameworkMessage, MochaError } from './types.js';
3import type { EventEmitter } from 'node:events';
4type EventTypes = 'hook' | 'test' | 'suite';
5interface ParsedConfiguration extends Required<Options.Testrunner> {
6 rootDir: string;
7 mochaOpts: MochaOptsImport;
8}
9/**
10 * Mocha runner
11 */
12declare class MochaAdapter {
13 private _cid;
14 private _config;
15 private _specs;
16 private _capabilities;
17 private _reporter;
18 private _mocha?;
19 private _runner?;
20 private _specLoadError?;
21 private _level;
22 private _hasTests;
23 private _suiteIds;
24 private _suiteCnt;
25 private _hookCnt;
26 private _testCnt;
27 private _suiteStartDate;
28 constructor(_cid: string, _config: ParsedConfiguration, _specs: string[], _capabilities: WebdriverIO.Capabilities, _reporter: EventEmitter);
29 init(): Promise<this>;
30 _loadFiles(mochaOpts: MochaOptsImport): Promise<void>;
31 hasTests(): boolean;
32 run(): Promise<unknown>;
33 /**
34 * Hooks which are added as true Mocha hooks need to call done() to notify async
35 */
36 wrapHook(hookName: keyof Services.HookFunctions): () => Promise<void | unknown[]>;
37 prepareMessage(hookName: keyof Services.HookFunctions): import("./types.js").FormattedMessage;
38 emit(event: string, payload: Record<string, unknown>, err?: MochaError): void;
39 getSyncEventIdStart(type: EventTypes): string;
40 getSyncEventIdEnd(type: EventTypes): string;
41 getUID(message: FrameworkMessage): string;
42}
43declare const adapterFactory: {
44 init?: Function;
45};
46export default adapterFactory;
47export { MochaAdapter, adapterFactory };
48export * from './types.js';
49declare global {
50 namespace WebdriverIO {
51 interface MochaOpts extends MochaOptsImport {
52 }
53 }
54}
55//# sourceMappingURL=index.d.ts.map
\No newline at end of file