Assert

Assert

Assert A generic assertion test class that evaluates either a boolean or a function returning boolean. Inherits from TestBase. Typically used for boolean tests or custom logic.

Constructor

new Assert(testName, test, successMessageopt, failureMessageopt, additionalDataopt, thisArgopt)

Description:
  • A test that evaluates a function or boolean and tracks its result. If the test value is a function, it's called and timed. If the function throws, it fails and captures the error.
Source:
Parameters:
Name Type Attributes Default Description
testName string Name of the test.
test function | boolean Test logic (function or static boolean).
successMessage string <optional>
Custom message on success.
failureMessage string <optional>
Custom message on failure.
additionalData any <optional>
Extra data to log.
thisArg any <optional>
globalThis `this` context to bind when calling the function.