jest-util

  • Version 30.4.1
  • Published
  • 56.7 kB
  • 6 dependencies
  • MIT license

Install

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

Overview

Overview not available.

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 canDeleteProperties

          canDeleteProperties: (value: unknown) => value is object;
          • Whether the given value has properties that can be deleted (regardless of protection).

            Parameter value

            The given value.

          function clearLine

          clearLine: (stream: WriteStream) => void;

            function convertDescriptorToString

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

              function createDirectory

              createDirectory: (path: string) => void;

                function deepCyclicCopy

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

                  function deleteProperties

                  deleteProperties: (value: unknown) => void;
                  • Deletes all the properties from the given value (if it's an object), unless the value was protected via .

                    Parameter value

                    the given value.

                  function formatTime

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

                    function globsToMatcher

                    globsToMatcher: (
                    globs: Array<string>,
                    picomatchOptions?: picomatch.PicomatchOptions
                    ) => 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 initializeGarbageCollectionUtils

                    initializeGarbageCollectionUtils: (
                    globalObject: typeof globalThis,
                    deletionMode: DeletionMode
                    ) => void;
                    • Initializes the garbage collection utils with the given deletion mode.

                      Parameter globalObject

                      the global object on which to store the deletion mode.

                      Parameter deletionMode

                      the deletion mode to use.

                    function installCommonGlobals

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

                      function interopRequireDefault

                      interopRequireDefault: (obj: any) => any;

                        function invariant

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

                          function isError

                          isError: (error: unknown) => error is Error;

                            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: WriteStream) => void;

                                    function protectProperties

                                    protectProperties: <T>(
                                    value: T,
                                    properties?: Array<keyof T>,
                                    depth?: number
                                    ) => boolean;
                                    • Protects the given value from being deleted by .

                                      Parameter value

                                      The given value.

                                      Parameter properties

                                      If the array contains any property, then only these properties will be protected; otherwise if the array is empty, all properties will be protected.

                                      Parameter depth

                                      Determines how "deep" the protection should be. A value of 0 means that only the top-most properties will be protected, while a value larger than 0 means that deeper levels of nesting will be protected as well.

                                    function remove

                                    remove: (stream: 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_2.Global,
                                          key: string | symbol,
                                          value: unknown,
                                          afterTeardown?: 'clean' | 'retain'
                                          ) => void;

                                            function tryRealpath

                                            tryRealpath: (path: string) => string;

                                              Classes

                                              class ErrorWithStack

                                              class ErrorWithStack extends Error {}

                                                constructor

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

                                                  Type Aliases

                                                  type DeletionMode

                                                  type DeletionMode = 'soft' | 'off' | 'on';
                                                  • - off: deletion is completely turned off. - soft: doesn't delete objects, but instead wraps their getter/setter with a deprecation warning. - on: actually delete objects (using delete).

                                                  Namespaces

                                                  namespace preRunMessage

                                                  namespace preRunMessage {}

                                                    function print

                                                    print: (stream: WriteStream) => void;

                                                      function remove

                                                      remove: (stream: 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 (5)

                                                                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>