• Version 18.0.2
  • Published
  • 164 kB
  • 17 dependencies
  • BSD-3-Clause license


npm i lab
yarn add lab
pnpm add lab


Test utility



variable assertions

const assertions: any;


    function script

    script: (options?: ScriptOptions) => Script;


      interface After

      interface After {}

        call signature

        (operation: Operation): void;

          call signature

          (options: Options, operation: Operation): void;

            interface Before

            interface Before extends After {}

              interface Experiment

              interface Experiment extends ExperimentFunction {}

                property only

                only: ExperimentFunction;
                • only execute this experiment

                property skip

                skip: ExperimentFunction;
                • skip this experiment

                interface ExperimentFunction

                interface ExperimentFunction {}

                  call signature

                  (title: String, experiment: () => void): void;

                    call signature

                    (title: String, options: ExperimentOptions, experiment: () => void): void;

                      interface ExperimentOptions

                      interface ExperimentOptions extends Options {}

                        property only

                        only?: boolean;
                        • only run this experiment/test

                        property skip

                        skip?: boolean;
                        • skip this experiment

                        interface Flags

                        interface Flags extends OperationFlags {}

                          method note

                          note: (note: string) => void;

                            method onCleanup

                            onCleanup: (operation: Operation) => void;

                              method onUncaughtException

                              onUncaughtException: (err: Error) => void;

                                method onUnhandledRejection

                                onUnhandledRejection: (err: Error) => void;

                                  interface Operation

                                  interface Operation {}

                                    call signature

                                    <T>(flags: OperationFlags): Promise<T> | void;

                                      call signature

                                      (flags: OperationFlags): void;

                                        interface OperationFlags

                                        interface OperationFlags {}

                                          property context

                                          context: Record<string, any>;

                                            interface Options

                                            interface Options {}

                                              property timeout

                                              timeout?: number;
                                              • number of ms to wait for test/experiment to execute

                                              interface Plan

                                              interface Plan {}

                                                property plan

                                                plan?: number;
                                                • number of assertions expected to execute

                                                interface Script

                                                interface Script {}

                                                  property after

                                                  after: After;

                                                    property afterEach

                                                    afterEach: After;

                                                      property before

                                                      before: Before;

                                                        property beforeEach

                                                        beforeEach: Before;

                                                          property describe

                                                          describe: Experiment;

                                                            property experiment

                                                            experiment: Experiment;

                                                              property it

                                                              it: Test;

                                                                property suite

                                                                suite: Experiment;

                                                                  property test

                                                                  test: Test;

                                                                    method expect

                                                                    expect: (value: any) => any;

                                                                      interface ScriptOptions

                                                                      interface ScriptOptions {}

                                                                        property cli

                                                                        cli?: any;

                                                                          property schedule

                                                                          schedule?: boolean;
                                                                          • should execution of tests be delayed until the CLI runs them

                                                                          interface Test

                                                                          interface Test {}

                                                                            method only

                                                                            only: {
                                                                            (title: String, test: TestFunction): void;
                                                                            (title: String, options: TestOptionsOnlySkip, test: TestFunction): void;
                                                                            • only execute this test

                                                                            method skip

                                                                            skip: {
                                                                            (title: String, test: TestFunction): void;
                                                                            (title: String, options: TestOptionsOnlySkip, test: TestFunction): void;
                                                                            • skip this test

                                                                            call signature

                                                                            (title: String, test: TestFunction): void;

                                                                              call signature

                                                                              (title: String, options: TestOptions, test: TestFunction): void;

                                                                                interface TestFunction

                                                                                interface TestFunction {}

                                                                                  call signature

                                                                                  <T>(flags: Flags): Promise<T> | void;

                                                                                    call signature

                                                                                    (flags: Flags): void;

                                                                                      interface TestOptions

                                                                                      interface TestOptions extends ExperimentOptions, Plan {}

                                                                                        interface TestOptionsOnlySkip

                                                                                        interface TestOptionsOnlySkip extends Options, Plan {}

                                                                                          Package Files (1)

                                                                                          Dependencies (17)

                                                                                          Dev Dependencies (6)

                                                                                          Peer Dependencies (0)

                                                                                          No peer dependencies.


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

                                                                                          You may also use to create a custom badge linking to

                                                                                          • Markdown
                                                                                          • HTML
                                                                                            <a href=""><img src="" alt=""></a>