ThrowsBase

ThrowsBase

ThrowsBase Base class for tests that evaluate whether a function throws or not. Supports optional error validation via predicate functions. Inherits from Assert. Not used directly — use Throws or NoThrows instead.

Constructor

new ThrowsBase(testName, expectingError, fn, checkErrorFnopt, thisArgopt)

Description:
  • Base class to test whether a function throws (or not), and optionally validate the error thrown.
Source:
Parameters:
Name Type Attributes Description
testName string Name of the test.
expectingError boolean Whether an error is expected (`true` = should throw).
fn function Function to test.
checkErrorFn function <optional>
Optional error predicate to validate the thrown error.
thisArg any <optional>
Optional `this` context for invoking the test/check function.

Methods

runImpl()

Description:
  • Executes the test, checking if an error was thrown and optionally applying a predicate on the error.
Source: