method Assert.prototype.pushResult
Assert.prototype.pushResult(resultInfo?: PushResultInfo): this

Pushes a custom assertion result. Fails the test if resultInfo.result is falsy. Throws an AssertionError on failure.

Useful for building custom assertion helpers.

Examples

Example 1

test("custom assertion", (assert) => {
  assert.pushResult({
    result: 1 + 1 === 2,
    actual: 2,
    expected: 2,
    message: "custom math check",
  });
});

Parameters

optional
resultInfo: PushResultInfo

Return Type

this

Usage

import { Assert } from ".";