jest-util

  • Version 29.7.0
  • Published
  • 41.8 kB
  • 6 dependencies
  • MIT license

Install

npm i jest-util
yarn add jest-util
pnpm add jest-util

Overview

This packages is a collection of utilities and helper functions

Index

Variables

variable ARROW

const ARROW: string;

    variable CLEAR

    const CLEAR: string;

      variable ICONS

      const ICONS: { failed: string; pending: string; success: string; todo: string };

        variable isInteractive

        const isInteractive: boolean;

          Functions

          function clearLine

          clearLine: (stream: NodeJS.WriteStream) => void;

            function convertDescriptorToString

            convertDescriptorToString: (
            descriptor: Global.BlockNameLike | undefined
            ) => string;

              function createDirectory

              createDirectory: (path: string) => void;

                function deepCyclicCopy

                deepCyclicCopy: <T>(
                value: T,
                options?: DeepCyclicCopyOptions,
                cycles?: WeakMap<any, any>
                ) => T;

                  function formatTime

                  formatTime: (
                  time: number,
                  prefixPower?: number,
                  padLeftLength?: number
                  ) => string;

                    function globsToMatcher

                    globsToMatcher: (globs: Array<string>) => Matcher;
                    • Converts a list of globs into a function that matches a path against the globs.

                      Every time picomatch is called, it will parse the glob strings and turn them into regexp instances. Instead of calling picomatch repeatedly with the same globs, we can use this function which will build the picomatch matchers ahead of time and then have an optimized path for determining whether an individual path matches.

                      This function is intended to match the behavior of micromatch().

                      Example 1

                      const isMatch = globsToMatcher(['*.js', '!*.test.js']); isMatch('pizza.js'); // true isMatch('pizza.test.js'); // false

                    function installCommonGlobals

                    installCommonGlobals: (
                    globalObject: typeof globalThis,
                    globals: Config.ConfigGlobals
                    ) => typeof globalThis & Config.ConfigGlobals;

                      function interopRequireDefault

                      interopRequireDefault: (obj: any) => any;

                        function invariant

                        invariant: (condition: unknown, message?: string) => asserts condition;

                          function isNonNullable

                          isNonNullable: <T>(value: T) => value is NonNullable<T>;

                            function isPromise

                            isPromise: <T = unknown>(candidate: unknown) => candidate is PromiseLike<T>;

                              function pluralize

                              pluralize: (word: string, count: number, ending?: string) => string;
                                print_2: (stream: NodeJS.WriteStream) => void;

                                  function remove

                                  remove: (stream: NodeJS.WriteStream) => void;

                                    function replacePathSepForGlob

                                    replacePathSepForGlob: (path: string) => string;

                                      function requireOrImportModule

                                      requireOrImportModule: <T>(
                                      filePath: string,
                                      applyInteropRequireDefault?: boolean
                                      ) => Promise<T>;

                                        function setGlobal

                                        setGlobal: (
                                        globalToMutate: typeof globalThis | Global.Global,
                                        key: string,
                                        value: unknown
                                        ) => void;

                                          function testPathPatternToRegExp

                                          testPathPatternToRegExp: (testPathPattern: Config.GlobalConfig) => RegExp;

                                            function tryRealpath

                                            tryRealpath: (path: string) => string;

                                              Classes

                                              class ErrorWithStack

                                              class ErrorWithStack extends Error {}

                                                constructor

                                                constructor(
                                                message: string,
                                                callsite: (...args: Array<any>) => unknown,
                                                stackLimit?: number
                                                );

                                                  Namespaces

                                                  namespace preRunMessage

                                                  namespace preRunMessage {}

                                                    function print

                                                    print: (stream: NodeJS.WriteStream) => void;

                                                      function remove

                                                      remove: (stream: NodeJS.WriteStream) => void;

                                                        namespace specialChars

                                                        namespace specialChars {}

                                                          variable ARROW

                                                          const ARROW: string;

                                                            variable CLEAR

                                                            const CLEAR: string;

                                                              variable ICONS

                                                              const ICONS: { failed: string; pending: string; success: string; todo: string };

                                                                Package Files (1)

                                                                Dependencies (6)

                                                                Dev Dependencies (2)

                                                                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/jest-util.

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