Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Properties

files

files: string[]

globalSetup

globalSetup: HookFunction

Configures one or more global setup fixtures. If given no parameters, unsets any previously-set fixtures.

see

https://mochajs.org/api/mocha#globalSetup

globalTeardown

globalTeardown: HookFunction

Configures one or more global teardown fixtures. If given no parameters, unsets any previously-set fixtures.

see

https://mochajs.org/api/mocha#globalTeardown

options

suite

suite: Suite

Methods

addFile

allowUncaught

  • allowUncaught(): boolean

asyncOnly

bail

checkLeaks

cleanReferencesAfterRun

delay

  • delay(): boolean

dispose

  • dispose(): void
  • Manually dispose this mocha instance. Mark this instance as disposed and unable to run more tests. It also removes function references to tests functions and hooks, so variables trapped in closures can be cleaned by the garbage collector.

    see

    https://mochajs.org/api/mocha#dispose

    Returns void

dryRun

  • Whether to activate dry-run mode.

    Parameters

    • Optional dryRun: boolean

      Whether to activate dry-run mode. Defaults to true.

    Returns BrowserMocha

enableGlobalSetup

enableGlobalTeardown

fgrep

forbidOnly

  • forbidOnly(): boolean

forbidPending

  • forbidPending(): boolean

fullTrace

globals

  • globals(globals: string | readonly string[]): BrowserMocha

grep

growl

hasGlobalSetupFixtures

  • hasGlobalSetupFixtures(): boolean

hasGlobalTeardownFixtures

  • hasGlobalTeardownFixtures(): boolean

invert

Protected loadFiles

  • loadFiles(fn?: () => void): void

loadFilesAsync

noHighlighting

parallelMode

reporter

retries

rootHooks

run

  • run(fn?: (failures: number) => void): Runner
  • Run tests and invoke fn() when complete.

    Note that run relies on Node's require to execute the test interface functions and will be subject to the cache - if the files are already in the require cache, they will effectively be skipped. Therefore, to run tests multiple times or to run tests in files that are already in the require cache, make sure to clear them from the cache first in whichever manner best suits your needs.

    see

    https://mochajs.org/api/mocha#run

    Parameters

    • Optional fn: (failures: number) => void
        • (failures: number): void
        • Parameters

          • failures: number

          Returns void

    Returns Runner

setup

slow

throwError

  • throwError(err: any): never
  • Function to allow assertion libraries to throw errors directly into mocha. This is useful when running tests in a browser because window.onerror will only receive the 'message' attribute of the Error.

    • Only supported in the browser.

    Parameters

    • err: any

    Returns never

timeout

ui

unloadFiles

  • Unloads files from Node's require cache.

    This allows required files to be "freshly" reloaded, providing the ability to reuse a Mocha instance programmatically. Note: does not clear ESM module files from the cache

    Returns BrowserMocha