• Version 8.32.3
  • Published
  • 29.7 kB
  • 6 dependencies
  • MIT license


npm i @wdio/mocha-framework
yarn add @wdio/mocha-framework
pnpm add @wdio/mocha-framework


A WebdriverIO plugin. Adapter for Mocha testing framework.



variable adapterFactory

const adapterFactory: { init?: Function };


    class MochaAdapter

    class MochaAdapter {}
    • Mocha runner


    _cid: string,
    _config: ParsedConfiguration,
    _specs: string[],
    _capabilities: Capabilities.RemoteCapability,
    _reporter: EventEmitter

      method emit

      emit: (event: string, payload: any, err?: MochaError) => void;

        method getSyncEventIdEnd

        getSyncEventIdEnd: (type: EventTypes) => string;

          method getSyncEventIdStart

          getSyncEventIdStart: (type: EventTypes) => string;

            method getUID

            getUID: (message: FrameworkMessage) => string;

              method hasTests

              hasTests: () => boolean;

                method init

                init: () => Promise<this>;

                  method prepareMessage

                  prepareMessage: (
                  hookName: keyof Services.HookFunctions
                  ) => import('./types.js').FormattedMessage;

                    method run

                    run: () => Promise<unknown>;

                      method wrapHook

                      wrapHook: (
                      hookName: keyof Services.HookFunctions
                      ) => () => Promise<void | unknown[]>;
                      • Hooks which are added as true Mocha hooks need to call done() to notify async


                      interface FormattedMessage

                      interface FormattedMessage {}

                        property body

                        body?: string;

                          property cid

                          cid?: string;

                            property context

                            context?: any;

                              property currentTest

                              currentTest?: string;

                                property duration

                                duration?: number;

                                  property error

                                  error?: MochaError;

                                    property file

                                    file?: string;

                                      property fullTitle

                                      fullTitle?: string;

                                        property parent

                                        parent?: string;

                                          property passed

                                          passed?: boolean;

                                            property pending

                                            pending?: boolean;

                                              property specs

                                              specs?: string[];

                                                property title

                                                title?: string;

                                                  property type

                                                  type: string;

                                                    property uid

                                                    uid?: string;

                                                      interface FrameworkMessage

                                                      interface FrameworkMessage {}

                                                        property err

                                                        err?: MochaError;

                                                          property payload

                                                          payload?: any;

                                                            property type

                                                            type: string;

                                                              interface MochaError

                                                              interface MochaError {}

                                                                property actual

                                                                actual: any;

                                                                  property expected

                                                                  expected: any;

                                                                    property message

                                                                    message: string;

                                                                      property name

                                                                      name: string;

                                                                        property stack

                                                                        stack: string;

                                                                          property type

                                                                          type: string;

                                                                            interface MochaOpts

                                                                            interface MochaOpts {}

                                                                              property allowUncaught

                                                                              allowUncaught?: boolean;
                                                                              • Propagate uncaught errors?

                                                                              property asyncOnly

                                                                              asyncOnly?: boolean;
                                                                              • Force done callback or promise?

                                                                              property bail

                                                                              bail?: boolean;
                                                                              • Bail after first test failure?

                                                                              property checkLeaks

                                                                              checkLeaks?: boolean;
                                                                              • Check for global variable leaks?

                                                                              property compilers

                                                                              compilers?: string[];
                                                                              • Use the given module(s) to compile files. Compilers will be included before requires (WebdriverIO framework option).

                                                                              property delay

                                                                              delay?: boolean;
                                                                              • Delay root suite execution?

                                                                              property fgrep

                                                                              fgrep?: string;
                                                                              • Test filter given string.

                                                                              property forbidOnly

                                                                              forbidOnly?: boolean;
                                                                              • Tests marked only fail the suite?

                                                                              property forbidPending

                                                                              forbidPending?: boolean;
                                                                              • Pending tests fail the suite?

                                                                              property fullTrace

                                                                              fullTrace?: boolean;
                                                                              • Full stacktrace upon failure?

                                                                              property global

                                                                              global?: string[];
                                                                              • Variables expected in global scope.

                                                                              property grep

                                                                              grep?: RegExp | string;
                                                                              • Test filter given regular expression.

                                                                              property invert

                                                                              invert?: boolean;
                                                                              • Invert test filter matches?

                                                                              property require

                                                                              require?: string[];
                                                                              • The require option is useful when you want to add or extend some basic functionality (WebdriverIO framework option).

                                                                              property retries

                                                                              retries?: number;
                                                                              • Number of times to retry failed tests.

                                                                              property timeout

                                                                              timeout?: number | string;
                                                                              • Timeout threshold value.

                                                                              property ui

                                                                              ui?: 'bdd' | 'tdd' | 'qunit' | 'exports';
                                                                              • Set test UI to one of the built-in test interfaces.


                                                                              namespace global

                                                                              namespace global {}

                                                                                namespace global.WebdriverIO

                                                                                namespace global.WebdriverIO {}

                                                                                  interface MochaOpts

                                                                                  interface MochaOpts extends MochaOptsImport {}

                                                                                    Package Files (2)

                                                                                    Dependencies (6)

                                                                                    Dev Dependencies (0)

                                                                                    No dev dependencies.

                                                                                    Peer Dependencies (0)

                                                                                    No peer dependencies.


                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@wdio/mocha-framework.

                                                                                    • Markdown
                                                                                    • HTML
                                                                                      <a href="https://www.jsdocs.io/package/@wdio/mocha-framework"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>