Module: util

Exposes a list of functions to help writing tests.

Source:

Methods

(static) check(testFunction, done, doNotTerminateopt)

Executes a function then call done function.

Exception thrown by the function are catched and transmitted to the done function.

Chai throws exceptions while an assertion fails which makes difficult writing ansynchronous tests. Assertions in asynchronous tests must be surrounding by try/catch and call the Mocha done callback with the error in case of a failing assertion.

Parameters:
Name Type Attributes Default Description
testFunction function

The function to execute

done function

The function to call after executing the testFunction function

doNotTerminate Boolean <optional>
false

Indicates if done function must not be called after executing the testFunction function

Source: