wct-mocha

  • Version 1.1.0
  • Published
  • 277 kB
  • No dependencies
  • BSD-3-Clause license

Install

npm i wct-mocha
yarn add wct-mocha
pnpm add wct-mocha

Overview

Client-side library for testing web-components with Mocha.

Index

Functions

function extendInterfaces

extendInterfaces: (
helperName: string,
helperFactory: (
context: {},
teardown: (cb: () => void) => void,
interfaceName: 'tdd' | 'bdd'
) => void
) => void;
  • Registers an extension that extends the global Mocha implementation with new helper methods. These helper methods will be added to the window when tests run for both BDD and TDD interfaces.

function initialize

initialize: (initConfig?: config.Config) => void;

    Classes

    class ChildRunner

    class ChildRunner {}
    • A Mocha suite (or suites) run within a child iframe, but reported as if they are part of the current context.

    constructor

    constructor(url: string, parentScope: Window);

      property loadTimeout

      static loadTimeout: number;

        property parentScope

        parentScope: Window;

          property share

          share: SharedState;

            property state

            state: 'initializing' | 'loading' | 'complete';

              method current

              static current: () => ChildRunner | null;
              • {ChildRunner} The ChildRunner that was registered for this window.

              method done

              done: () => void;
              • Called when the sub suite's tests are complete, so that it can clean up.

              method get

              static get: (target: Window, traversal?: boolean) => ChildRunner | null;
              • Parameter target

                A window to find the ChildRunner of.

                Parameter traversal

                Whether this is a traversal from a child window. {ChildRunner} The ChildRunner that was registered for target.

              method loaded

              loaded: (error?: {}) => void;
              • Called when the sub suite's iframe has loaded (or errored during load).

                Parameter error

                The error that occured, if any.

              method ready

              ready: (error?: {}) => void;
              • Called in mocha/run.js when all dependencies have loaded, and the child is ready to start running tests

                Parameter error

                The error that occured, if any.

              method run

              run: (done: (error?: {}) => void) => void;
              • Loads and runs the subsuite.

                Parameter done

                Node-style callback.

              method signalRunComplete

              signalRunComplete: (error?: {}) => void;

                Namespaces

                namespace global

                namespace global {}

                  interface Window

                  interface Window {}

                    property define

                    define: Function;

                      Package Files (3)

                      Dependencies (0)

                      No dependencies.

                      Dev Dependencies (2)

                      Peer Dependencies (1)

                      Badge

                      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/wct-mocha.

                      • Markdown
                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/wct-mocha)
                      • HTML
                        <a href="https://www.jsdocs.io/package/wct-mocha"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>