should

  • Version 13.2.3
  • Published
  • 408 kB
  • 5 dependencies
  • MIT license

Install

npm i should
yarn add should
pnpm add should

Overview

test framework agnostic BDD-style assertions

Index

Variables

variable not

const not: ShouldAssertExt;

    Functions

    function deepEqual

    deepEqual: (actual: any, expected: any, message?: string) => void;

      function doesNotThrow

      doesNotThrow: {
      (block: Function, message?: string): void;
      (block: Function, error: Function, message?: string): void;
      (block: Function, error: RegExp, message?: string): void;
      (block: Function, error: (err: any) => boolean, message?: string): void;
      };

        function equal

        equal: (actual: any, expected: any, message?: string) => void;

          function exist

          exist: (obj: any, msg?: string) => void;

            function exists

            exists: (obj: any, msg?: string) => void;

              function fail

              fail: (actual: any, expected: any, message?: string, operator?: string) => void;

                function ifError

                ifError: (value: any) => void;

                  function notDeepEqual

                  notDeepEqual: (actual: any, expected: any, message?: string) => void;

                    function notEqual

                    notEqual: (actual: any, expected: any, message?: string) => void;

                      function notStrictEqual

                      notStrictEqual: (actual: any, expected: any, message?: string) => void;

                        function ok

                        ok: (value: any, message?: string) => void;

                          function should

                          should: typeof should;

                            function strictEqual

                            strictEqual: (actual: any, expected: any, message?: string) => void;

                              function throws

                              throws: {
                              (block: Function, message?: string): void;
                              (block: Function, error: Function, message?: string): void;
                              (block: Function, error: RegExp, message?: string): void;
                              (block: Function, error: (err: any) => boolean, message?: string): void;
                              };

                                Interfaces

                                interface Assertion

                                interface Assertion {}

                                  property a

                                  a: this;

                                    property an

                                    an: this;

                                      property and

                                      and: this;

                                        property any

                                        any: this;

                                          property be

                                          be: this;

                                            property been

                                            been: this;

                                              property eventually

                                              eventually: PromisedAssertion;

                                                property finally

                                                finally: PromisedAssertion;

                                                  property has

                                                  has: this;

                                                    property have

                                                    have: this;

                                                      property is

                                                      is: this;

                                                        property it

                                                        it: this;

                                                          property not

                                                          not: this;

                                                            property of

                                                            of: this;

                                                              property only

                                                              only: this;

                                                                property the

                                                                the: this;

                                                                  property which

                                                                  which: this;

                                                                    property with

                                                                    with: this;

                                                                      method above

                                                                      above: (value: number, description?: string) => this;

                                                                        method aboveOrEqual

                                                                        aboveOrEqual: (value: number, description?: string) => this;

                                                                          method approximately

                                                                          approximately: (value: number, delta: number, description?: string) => this;

                                                                            method arguments

                                                                            arguments: () => this;

                                                                              method Arguments

                                                                              Arguments: () => this;

                                                                                method Array

                                                                                Array: () => this;

                                                                                  method assert

                                                                                  assert: (expr: boolean) => this;

                                                                                    method below

                                                                                    below: (value: number, description?: string) => this;

                                                                                      method belowOrEqual

                                                                                      belowOrEqual: (value: number, description?: string) => this;

                                                                                        method Boolean

                                                                                        Boolean: () => this;

                                                                                          method class

                                                                                          class: (className: string) => this;

                                                                                            method Class

                                                                                            Class: (className: string) => this;

                                                                                              method containDeep

                                                                                              containDeep: (obj: any) => this;

                                                                                                method containDeepOrdered

                                                                                                containDeepOrdered: (obj: any) => this;

                                                                                                  method containEql

                                                                                                  containEql: (obj: any) => this;

                                                                                                    method Date

                                                                                                    Date: () => this;

                                                                                                      method deepEqual

                                                                                                      deepEqual: (obj: any, description?: string) => this;

                                                                                                        method empty

                                                                                                        empty: () => this;

                                                                                                          method endWith

                                                                                                          endWith: (postfix: string, description?: string) => this;

                                                                                                            method eql

                                                                                                            eql: (obj: any, description?: string) => this;

                                                                                                              method eqls

                                                                                                              eqls: (obj: any, description?: string) => this;

                                                                                                                method equal

                                                                                                                equal: (obj: any, description?: string) => this;

                                                                                                                  method equalOneOf

                                                                                                                  equalOneOf: { (...objs: any[]): this; (obj: any[]): this };

                                                                                                                    method equals

                                                                                                                    equals: (obj: any, description?: string) => this;

                                                                                                                      method Error

                                                                                                                      Error: () => this;

                                                                                                                        method exactly

                                                                                                                        exactly: (obj: any, description?: string) => this;

                                                                                                                          method fail

                                                                                                                          fail: () => this;

                                                                                                                            method false

                                                                                                                            false: (message?: string) => this;

                                                                                                                              method False

                                                                                                                              False: (message?: string) => this;

                                                                                                                                method fulfilled

                                                                                                                                fulfilled: () => Promise<any>;

                                                                                                                                  method fulfilledWith

                                                                                                                                  fulfilledWith: (obj: any) => Promise<any>;

                                                                                                                                    method Function

                                                                                                                                    Function: () => this;

                                                                                                                                      method generator

                                                                                                                                      generator: () => this;

                                                                                                                                        method greaterThan

                                                                                                                                        greaterThan: (value: number, description?: string) => this;

                                                                                                                                          method greaterThanOrEqual

                                                                                                                                          greaterThanOrEqual: (value: number, description?: string) => this;

                                                                                                                                            method hasOwnProperty

                                                                                                                                            hasOwnProperty: (name: string, description?: string) => this;

                                                                                                                                              method Infinity

                                                                                                                                              Infinity: () => this;

                                                                                                                                                method instanceof

                                                                                                                                                instanceof: (constructor: Function, description?: string) => this;

                                                                                                                                                  method instanceOf

                                                                                                                                                  instanceOf: (constructor: Function, description?: string) => this;

                                                                                                                                                    method iterable

                                                                                                                                                    iterable: () => this;

                                                                                                                                                      method iterator

                                                                                                                                                      iterator: () => this;

                                                                                                                                                        method key

                                                                                                                                                        key: (key: any) => this;

                                                                                                                                                          method keys

                                                                                                                                                          keys: (...keys: any[]) => this;

                                                                                                                                                            method length

                                                                                                                                                            length: (value: number, description?: string) => this;

                                                                                                                                                              method lengthOf

                                                                                                                                                              lengthOf: (value: number, description?: string) => this;

                                                                                                                                                                method lessThan

                                                                                                                                                                lessThan: (value: number, description?: string) => this;

                                                                                                                                                                  method lessThanOrEqual

                                                                                                                                                                  lessThanOrEqual: (value: number, description?: string) => this;

                                                                                                                                                                    method match

                                                                                                                                                                    match: (
                                                                                                                                                                    obj:
                                                                                                                                                                    | {}
                                                                                                                                                                    | RegExp
                                                                                                                                                                    | ((value: any, key: any) => boolean)
                                                                                                                                                                    | ((value: any, key: any) => void),
                                                                                                                                                                    description?: string
                                                                                                                                                                    ) => this;

                                                                                                                                                                      method matchAny

                                                                                                                                                                      matchAny: (
                                                                                                                                                                      obj:
                                                                                                                                                                      | {}
                                                                                                                                                                      | RegExp
                                                                                                                                                                      | ((value: any, key: any) => boolean)
                                                                                                                                                                      | ((value: any, key: any) => void),
                                                                                                                                                                      description?: string
                                                                                                                                                                      ) => this;

                                                                                                                                                                        method matchEach

                                                                                                                                                                        matchEach: (
                                                                                                                                                                        obj:
                                                                                                                                                                        | {}
                                                                                                                                                                        | RegExp
                                                                                                                                                                        | ((value: any, key: any) => boolean)
                                                                                                                                                                        | ((value: any, key: any) => void),
                                                                                                                                                                        description?: string
                                                                                                                                                                        ) => this;

                                                                                                                                                                          method matchEvery

                                                                                                                                                                          matchEvery: (
                                                                                                                                                                          obj:
                                                                                                                                                                          | {}
                                                                                                                                                                          | RegExp
                                                                                                                                                                          | ((value: any, key: any) => boolean)
                                                                                                                                                                          | ((value: any, key: any) => void),
                                                                                                                                                                          description?: string
                                                                                                                                                                          ) => this;

                                                                                                                                                                            method matchSome

                                                                                                                                                                            matchSome: (
                                                                                                                                                                            obj:
                                                                                                                                                                            | {}
                                                                                                                                                                            | RegExp
                                                                                                                                                                            | ((value: any, key: any) => boolean)
                                                                                                                                                                            | ((value: any, key: any) => void),
                                                                                                                                                                            description?: string
                                                                                                                                                                            ) => this;

                                                                                                                                                                              method NaN

                                                                                                                                                                              NaN: () => this;

                                                                                                                                                                                method null

                                                                                                                                                                                null: () => this;

                                                                                                                                                                                  method Null

                                                                                                                                                                                  Null: () => this;

                                                                                                                                                                                    method Number

                                                                                                                                                                                    Number: () => this;

                                                                                                                                                                                      method Object

                                                                                                                                                                                      Object: () => this;

                                                                                                                                                                                        method ok

                                                                                                                                                                                        ok: () => this;

                                                                                                                                                                                          method oneOf

                                                                                                                                                                                          oneOf: { (...objs: any[]): this; (obj: any[]): this };

                                                                                                                                                                                            method ownProperty

                                                                                                                                                                                            ownProperty: (name: string, description?: string) => this;

                                                                                                                                                                                              method Promise

                                                                                                                                                                                              Promise: () => this;

                                                                                                                                                                                                method properties

                                                                                                                                                                                                properties: {
                                                                                                                                                                                                (...names: string[]): this;
                                                                                                                                                                                                (names: string[]): this;
                                                                                                                                                                                                (props: {}): this;
                                                                                                                                                                                                };

                                                                                                                                                                                                  method property

                                                                                                                                                                                                  property: (name: string, value?: any) => this;

                                                                                                                                                                                                    method propertyByPath

                                                                                                                                                                                                    propertyByPath: { (...path: string[]): this; (path: string[]): this };

                                                                                                                                                                                                      method propertyWithDescriptor

                                                                                                                                                                                                      propertyWithDescriptor: (name: string, descriptor: {}) => this;

                                                                                                                                                                                                        method rejected

                                                                                                                                                                                                        rejected: () => Promise<any>;

                                                                                                                                                                                                          method rejectedWith

                                                                                                                                                                                                          rejectedWith: {
                                                                                                                                                                                                          (msg: RegExp | string | Error, properties?: {}): Promise<any>;
                                                                                                                                                                                                          (properties: {}): Promise<any>;
                                                                                                                                                                                                          };

                                                                                                                                                                                                            method resolved

                                                                                                                                                                                                            resolved: () => Promise<any>;

                                                                                                                                                                                                              method resolvedWith

                                                                                                                                                                                                              resolvedWith: (obj: any) => Promise<any>;

                                                                                                                                                                                                                method size

                                                                                                                                                                                                                size: (value: number) => this;

                                                                                                                                                                                                                  method startWith

                                                                                                                                                                                                                  startWith: (prefix: string, description?: string) => this;

                                                                                                                                                                                                                    method String

                                                                                                                                                                                                                    String: () => this;

                                                                                                                                                                                                                      method throw

                                                                                                                                                                                                                      throw: {
                                                                                                                                                                                                                      (): this;
                                                                                                                                                                                                                      (msg: string | Function | RegExp, properties?: {}): this;
                                                                                                                                                                                                                      (properties: {}): this;
                                                                                                                                                                                                                      };

                                                                                                                                                                                                                        method throwError

                                                                                                                                                                                                                        throwError: {
                                                                                                                                                                                                                        (): this;
                                                                                                                                                                                                                        (msg: string | Function | RegExp, properties?: {}): this;
                                                                                                                                                                                                                        (properties: {}): this;
                                                                                                                                                                                                                        };

                                                                                                                                                                                                                          method true

                                                                                                                                                                                                                          true: (message?: string) => this;

                                                                                                                                                                                                                            method True

                                                                                                                                                                                                                            True: (message?: string) => this;

                                                                                                                                                                                                                              method type

                                                                                                                                                                                                                              type: (typeName: string, description?: string) => this;

                                                                                                                                                                                                                                method undefined

                                                                                                                                                                                                                                undefined: () => this;

                                                                                                                                                                                                                                  method Undefined

                                                                                                                                                                                                                                  Undefined: () => this;

                                                                                                                                                                                                                                    method value

                                                                                                                                                                                                                                    value: (key: any, value: any) => this;

                                                                                                                                                                                                                                      method within

                                                                                                                                                                                                                                      within: (start: number, finish: number, description?: string) => this;

                                                                                                                                                                                                                                        interface PromisedAssertion

                                                                                                                                                                                                                                        interface PromisedAssertion extends Assertion, PromiseLike<any> {}

                                                                                                                                                                                                                                          interface ShouldAssertExt

                                                                                                                                                                                                                                          interface ShouldAssertExt {}

                                                                                                                                                                                                                                            method exist

                                                                                                                                                                                                                                            exist: (obj: any, msg?: string) => void;

                                                                                                                                                                                                                                              method exists

                                                                                                                                                                                                                                              exists: (obj: any, msg?: string) => void;

                                                                                                                                                                                                                                                Namespaces

                                                                                                                                                                                                                                                namespace global

                                                                                                                                                                                                                                                namespace global {}

                                                                                                                                                                                                                                                  interface Object

                                                                                                                                                                                                                                                  interface Object {}

                                                                                                                                                                                                                                                    property should

                                                                                                                                                                                                                                                    should: should.Assertion;

                                                                                                                                                                                                                                                      Package Files (1)

                                                                                                                                                                                                                                                      Dependencies (5)

                                                                                                                                                                                                                                                      Dev Dependencies (11)

                                                                                                                                                                                                                                                      Peer Dependencies (0)

                                                                                                                                                                                                                                                      No peer dependencies.

                                                                                                                                                                                                                                                      Badge

                                                                                                                                                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/should.

                                                                                                                                                                                                                                                      • Markdown
                                                                                                                                                                                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/should)
                                                                                                                                                                                                                                                      • HTML
                                                                                                                                                                                                                                                        <a href="https://www.jsdocs.io/package/should"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>