1. assertion-error
Error constructor for test and validation frameworks that implements standardized AssertionError specification.
assertion-error
Package: assertion-error
Created by: chaijs
Last modified: Wed, 18 Oct 2023 18:04:13 GMT
Version: 2.0.1
License: MIT
Downloads: 40,308,018
Repository: https://github.com/chaijs/assertion-error

Install

npm install assertion-error
yarn add assertion-error

AssertionError and AssertionResult classes.

build:? downloads:? devDependencies:none

What is AssertionError?

Assertion Error is a module that contains two classes: AssertionError, which
is an instance of an Error, and AssertionResult which is not an instance of
Error.

These can be useful for returning from a function - if the function "succeeds"
return an AssertionResult and if the function fails return (or throw) an
AssertionError.

Both AssertionError and AssertionResult implement the Result interface:

 interface Result {
  name: "AssertionError" | "AssertionResult";
  ok: boolean;
  toJSON(...args: unknown[]): Record<string, unknown>;
}

So if a function returns AssertionResult | AssertionError it is easy to check
which one is returned by checking either .name or .ok, or check
instanceof Error.

Installation

Node.js

assertion-error is available on npm.

$ npm install --save assertion-error

Deno

assertion_error is available on
Deno.land

 import {
  AssertionError,
  AssertionResult,
} from "https://deno.land/x/[email protected]/mod.ts";

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin