jest-util
This packages is a collection of utilities and helper functions
Last updated a year ago by simenb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install jest-util 
SYNC missed versions from official npm registry.

@jest/utils

This packages is a collection of utilities and helper functions

ErrorWithStack

This custom error class can be useful when you need to capture the stack trace of an error and provide additional context to the error message. By default, JavaScript errors only capture the stack trace when they are thrown, but this class allows you to capture the stack trace at any point in your code by calling its constructor.

clearLine

It ensures that the clearing operation is only performed when running in a terminal environment, and not when the output is redirected to a file or another non-terminal destination.

convertDescriptorToString

It defines a function named convertDescriptorToString that takes a descriptor as input and converts it to a string based on its type. It handles various types such as functions, numbers, strings, and undefined values. If the input doesn't match any of these types, it throws an error with a descriptive message.

createDirectory

It creates new directory and also allows creation of nested directories.

deepCyclicCopy

The deepCyclicCopy function provides deep copying of JavaScript objects and arrays, including handling circular references. It offers optional customization through a DeepCyclicCopyOptions parameter, allowing users to blacklist properties and preserve object prototypes. The function returns a completely independent deep copy of the input data structure.

formatTime

This function is useful for formatting time values with appropriate SI unit prefixes for readability. It expresses time in various units (e.g., milliseconds, microseconds, nanoseconds) while ensuring the formatting is consistent and human-readable.

globsToMatcher

The code efficiently converts a list of glob patterns into a reusable function for matching paths against those patterns, considering negated patterns and optimizing for performance.

installCommonGlobals

Sets up various global variables and functions needed by the Jest testing framework. It ensures that these globals are properly set up for testing scenarios while maintaining compatibility with the environment's global object.

interopRequireDefault

Provides a way to ensure compatibility between ES modules and CommonJS modules by handling the default export behavior appropriately.

invariant

It is a utility used for asserting that a given condition is true. It's often used as a debugging aid during development to catch situations where an expected condition is not met.

isInteractive

Checks whether the current environment is suitable for interactive terminal interactions.

isNonNullable

Used to narrow down the type of a variable within a TypeScript code block, ensuring that it is safe to assume that the value is non-nullable. This can help avoid runtime errors related to null or undefined values.

isPromise

It helps in order to determine whether a given value conforms to the structure of a Promise-like object, which typically has a then method. This can be useful when working with asynchronous code to ensure dealing with promises correctly.

pluralize

This function is used to easily generate grammatically correct phrases in text output that depend on the count of items. It ensures that the word is correctly pluralized when needed.

preRunMessage

These functions are intended for use in interactive command-line tools or scripts which provide informative messages to the user while ensuring a clean and responsive interface.

replacePathSepForGlob

The function takes a string path as input and replaces backslashes ('\') with forward slashes ('/') in the path. Used to normalize file paths to be compatible with glob patterns, ensuring consistency in path representation for different operating systems.

requireOrImportModule

This function provides a unified way to load modules regardless of whether they use CommonJS or ESM syntax. It ensures that the default export is applied consistently when needed, allowing users to work with modules that might use different module systems.

setGlobal

Used to set properties with specified values within a global object. It is designed to work in both browser-like and Node.js environments by accepting different types of global objects as input.

specialChars

It defines constants and conditional values for handling platform-specific behaviors in a terminal environment. It determines if the current platform is Windows ('win32') and sets up constants for various symbols and terminal screen clearing escape sequences accordingly, ensuring proper display and behavior on both Windows and non-Windows operating systems.

TestPathPatterns

This class takes test patterns and provides the API for deciding if a test matches any of the patterns.

tryRealpath

Used to resolve the real path of a given path, but if the path doesn't exist or is a directory, it doesn't throw an error and returns the original path string. This can be useful for gracefully handling path resolution in scenarios where some paths might not exist or might be directories.

Current Tags

  • 29.7.0                                ...           latest (a year ago)
  • 30.0.0-alpha.6                                ...           next (5 months ago)

261 Versions

  • 30.0.0-alpha.6                                ...           5 months ago
  • 30.0.0-alpha.5                                ...           7 months ago
  • 30.0.0-alpha.4                                ...           7 months ago
  • 30.0.0-alpha.3                                ...           10 months ago
  • 30.0.0-alpha.2                                ...           a year ago
  • 30.0.0-alpha.1                                ...           a year ago
  • 29.7.0                                ...           a year ago
  • 29.6.3                                ...           a year ago
  • 29.6.2                                ...           a year ago
  • 29.6.1                                ...           a year ago
  • 29.6.0                                ...           a year ago
  • 29.5.0                                ...           2 years ago
  • 29.4.3                                ...           2 years ago
  • 29.4.2                                ...           2 years ago
  • 29.4.1                                ...           2 years ago
  • 29.4.0                                ...           2 years ago
  • 29.3.1                                ...           2 years ago
  • 29.2.1                                ...           2 years ago
  • 29.2.0                                ...           2 years ago
  • 29.1.2                                ...           2 years ago
  • 29.1.0                                ...           2 years ago
  • 29.0.3                                ...           2 years ago
  • 29.0.2                                ...           2 years ago
  • 29.0.1                                ...           2 years ago
  • 29.0.0                                ...           2 years ago
  • 29.0.0-alpha.6                                ...           2 years ago
  • 29.0.0-alpha.4                                ...           2 years ago
  • 29.0.0-alpha.3                                ...           2 years ago
  • 29.0.0-alpha.0                                ...           2 years ago
  • 28.1.3                                ...           2 years ago
  • 28.1.1                                ...           3 years ago
  • 28.1.0                                ...           3 years ago
  • 28.0.2                                ...           3 years ago
  • 28.0.1                                ...           3 years ago
  • 28.0.0                                ...           3 years ago
  • 28.0.0-alpha.9                                ...           3 years ago
  • 28.0.0-alpha.8                                ...           3 years ago
  • 28.0.0-alpha.7                                ...           3 years ago
  • 28.0.0-alpha.6                                ...           3 years ago
  • 28.0.0-alpha.5                                ...           3 years ago
  • 28.0.0-alpha.4                                ...           3 years ago
  • 28.0.0-alpha.3                                ...           3 years ago
  • 28.0.0-alpha.2                                ...           3 years ago
  • 28.0.0-alpha.1                                ...           3 years ago
  • 28.0.0-alpha.0                                ...           3 years ago
  • 27.5.1                                ...           3 years ago
  • 27.5.0                                ...           3 years ago
  • 27.4.2                                ...           3 years ago
  • 27.4.1                                ...           3 years ago
  • 27.4.0                                ...           3 years ago
  • 27.3.1                                ...           3 years ago
  • 27.3.0                                ...           3 years ago
  • 27.2.5                                ...           3 years ago
  • 27.2.4                                ...           3 years ago
  • 27.2.3                                ...           3 years ago
  • 27.2.0                                ...           3 years ago
  • 27.1.1                                ...           3 years ago
  • 27.1.0                                ...           3 years ago
  • 27.0.6                                ...           3 years ago
  • 27.0.2                                ...           4 years ago
  • 27.0.1                                ...           4 years ago
  • 27.0.0-next.11                                ...           4 years ago
  • 27.0.0-next.10                                ...           4 years ago
  • 27.0.0-next.9                                ...           4 years ago
  • 27.0.0-next.8                                ...           4 years ago
  • 27.0.0-next.7                                ...           4 years ago
  • 27.0.0-next.6                                ...           4 years ago
  • 27.0.0-next.3                                ...           4 years ago
  • 27.0.0-next.1                                ...           4 years ago
  • 27.0.0-next.0                                ...           4 years ago
  • 26.6.2                                ...           4 years ago
  • 26.6.1                                ...           4 years ago
  • 26.6.0                                ...           4 years ago
  • 26.5.2                                ...           4 years ago
  • 26.5.0                                ...           4 years ago
  • 26.3.0                                ...           4 years ago
  • 26.2.0                                ...           4 years ago
  • 26.1.0                                ...           5 years ago
  • 26.0.1                                ...           5 years ago
  • 26.0.1-alpha.0                                ...           5 years ago
  • 26.0.0                                ...           5 years ago
  • 26.0.0-alpha.2                                ...           5 years ago
  • 26.0.0-alpha.1                                ...           5 years ago
  • 26.0.0-alpha.0                                ...           5 years ago
  • 25.5.0                                ...           5 years ago
  • 25.4.0                                ...           5 years ago
  • 25.3.0                                ...           5 years ago
  • 25.2.6                                ...           5 years ago
  • 25.2.5 [deprecated]           ...           5 years ago
  • 25.2.3                                ...           5 years ago
  • 25.2.1                                ...           5 years ago
  • 25.2.1-alpha.2                                ...           5 years ago
  • 25.2.1-alpha.1                                ...           5 years ago
  • 25.2.0                                ...           5 years ago
  • 25.2.0-alpha.86                                ...           5 years ago
  • 25.1.0                                ...           5 years ago
  • 25.0.0                                ...           5 years ago
  • 24.9.0                                ...           5 years ago
  • 24.8.0                                ...           6 years ago
  • 24.7.1                                ...           6 years ago
  • 24.7.0                                ...           6 years ago
  • 24.6.0                                ...           6 years ago
  • 24.5.0                                ...           6 years ago
  • 24.3.0                                ...           6 years ago
  • 24.2.0-alpha.0                                ...           6 years ago
  • 24.0.0                                ...           6 years ago
  • 24.0.0-alpha.16                                ...           6 years ago
  • 24.0.0-alpha.15                                ...           6 years ago
  • 24.0.0-alpha.13                                ...           6 years ago
  • 24.0.0-alpha.12                                ...           6 years ago
  • 24.0.0-alpha.11                                ...           6 years ago
  • 24.0.0-alpha.10                                ...           6 years ago
  • 24.0.0-alpha.9                                ...           6 years ago
  • 24.0.0-alpha.7                                ...           6 years ago
  • 24.0.0-alpha.6                                ...           6 years ago
  • 24.0.0-alpha.5                                ...           6 years ago
  • 24.0.0-alpha.4                                ...           6 years ago
  • 24.0.0-alpha.3                                ...           6 years ago
  • 24.0.0-alpha.2                                ...           6 years ago
  • 24.0.0-alpha.1                                ...           6 years ago
  • 24.0.0-alpha.0                                ...           6 years ago
  • 23.4.0                                ...           6 years ago
  • 23.3.0                                ...           6 years ago
  • 23.2.0                                ...           6 years ago
  • 23.1.0                                ...           7 years ago
  • 23.0.1                                ...           7 years ago
  • 23.0.0                                ...           7 years ago
  • 23.0.0-charlie.4                                ...           7 years ago
  • 23.0.0-charlie.3                                ...           7 years ago
  • 23.0.0-charlie.2                                ...           7 years ago
  • 23.0.0-charlie.1                                ...           7 years ago
  • 23.0.0-charlie.0                                ...           7 years ago
  • 23.0.0-beta.3r                                ...           7 years ago
  • 23.0.0-alpha.3r                                ...           7 years ago
  • 23.0.0-beta.2                                ...           7 years ago
  • 23.0.0-beta.1                                ...           7 years ago
  • 23.0.0-beta.0                                ...           7 years ago
  • 23.0.0-alpha.7                                ...           7 years ago
  • 23.0.0-alpha.6r                                ...           7 years ago
  • 23.0.0-alpha.5r                                ...           7 years ago
  • 23.0.0-alpha.5                                ...           7 years ago
  • 23.0.0-alpha.4                                ...           7 years ago
  • 23.0.0-alpha.2                                ...           7 years ago
  • 22.4.3                                ...           7 years ago
  • 23.0.0-alpha.1                                ...           7 years ago
  • 23.0.0-alpha.0                                ...           7 years ago
  • 22.4.1                                ...           7 years ago
  • 22.4.0                                ...           7 years ago
  • 22.3.0                                ...           7 years ago
  • 22.2.2                                ...           7 years ago
  • 22.2.0                                ...           7 years ago
  • 22.1.4                                ...           7 years ago
  • 22.1.2                                ...           7 years ago
  • 22.1.0                                ...           7 years ago
  • 22.0.6                                ...           7 years ago
  • 22.0.5                                ...           7 years ago
  • 22.0.4                                ...           7 years ago
  • 22.0.3                                ...           7 years ago
  • 22.0.2                                ...           7 years ago
  • 22.0.1                                ...           7 years ago
  • 22.0.0                                ...           7 years ago
  • 21.3.0-beta.15                                ...           7 years ago
  • 21.3.0-beta.14                                ...           7 years ago
  • 21.3.0-beta.13                                ...           7 years ago
  • 21.3.0-beta.12                                ...           7 years ago
  • 21.3.0-beta.11                                ...           7 years ago
  • 21.3.0-beta.10                                ...           7 years ago
  • 21.3.0-beta.9                                ...           7 years ago
  • 21.3.0-beta.8                                ...           7 years ago
  • 21.3.0-beta.7                                ...           7 years ago
  • 21.3.0-beta.6                                ...           7 years ago
  • 21.3.0-beta.5                                ...           7 years ago
  • 21.3.0-beta.4                                ...           7 years ago
  • 21.3.0-beta.3                                ...           7 years ago
  • 21.3.0-beta.2                                ...           7 years ago
  • 21.3.0-beta.1                                ...           7 years ago
  • 21.3.0-alpha.eff7a1cf                                ...           7 years ago
  • 21.3.0-alpha.1e3ee68e                                ...           7 years ago
  • 21.2.1                                ...           7 years ago
  • 21.2.0                                ...           7 years ago
  • 21.1.0                                ...           7 years ago
  • 21.0.2                                ...           7 years ago
  • 21.0.0                                ...           7 years ago
  • 21.0.0-beta.1                                ...           7 years ago
  • 21.0.0-alpha.2                                ...           7 years ago
  • 21.0.0-alpha.1                                ...           7 years ago
  • 20.1.0-echo.1                                ...           7 years ago
  • 20.1.0-delta.5                                ...           7 years ago
  • 20.1.0-delta.4                                ...           7 years ago
  • 20.1.0-delta.3                                ...           7 years ago
  • 20.1.0-delta.2                                ...           7 years ago
  • 20.1.0-delta.1                                ...           7 years ago
  • 20.1.0-chi.1                                ...           7 years ago
  • 20.1.0-beta.1                                ...           7 years ago
  • 20.1.0-alpha.3                                ...           7 years ago
  • 20.1.0-alpha.2                                ...           7 years ago
  • 20.1.0-alpha.1                                ...           7 years ago
  • 20.0.3                                ...           8 years ago
  • 20.0.2                                ...           8 years ago
  • 20.0.1                                ...           8 years ago
  • 20.0.0                                ...           8 years ago
  • 19.3.0-alpha.85402254                                ...           8 years ago
  • 19.2.0-alpha.993e64af                                ...           8 years ago
  • 19.1.0-alpha.eed82034                                ...           8 years ago
  • 19.0.2                                ...           8 years ago
  • 19.0.1                                ...           8 years ago
  • 19.0.0                                ...           8 years ago
  • 18.5.0-alpha.7da3df39                                ...           8 years ago
  • 18.1.0                                ...           8 years ago
  • 18.0.0                                ...           8 years ago
  • 17.0.2                                ...           8 years ago
  • 17.0.0                                ...           8 years ago
  • 16.1.0-alpha.691b0e22                                ...           8 years ago
  • 16.0.2                                ...           8 years ago
  • 16.0.0                                ...           8 years ago
  • 15.2.0-alpha.c681f819                                ...           8 years ago
  • 15.1.1                                ...           8 years ago
  • 15.1.0                                ...           8 years ago
  • 15.0.1                                ...           8 years ago
  • 15.0.0                                ...           8 years ago
  • 14.3.2-alpha.83c25417                                ...           8 years ago
  • 14.3.1-alpha.410cb91a                                ...           8 years ago
  • 14.3.0-alpha.d13c163e                                ...           8 years ago
  • 14.2.2-alpha.22bd3c33                                ...           8 years ago
  • 14.2.1-alpha.e21d71a4                                ...           8 years ago
  • 14.2.0-alpha.ca8bfb6e                                ...           8 years ago
  • 14.0.0                                ...           8 years ago
  • 13.4.0-alpha.d2632006                                ...           8 years ago
  • 13.3.0-alpha.g8b48d59                                ...           8 years ago
  • 13.3.0-alpha.8b48d59e                                ...           8 years ago
  • 13.3.0-alpha.ffc7404b                                ...           8 years ago
  • 13.3.0-alpha.4eb0c908                                ...           8 years ago
  • 13.3.0-alpha.a44f195f                                ...           8 years ago
  • 13.2.2                                ...           8 years ago
  • 13.2.1                                ...           8 years ago
  • 13.1.2                                ...           8 years ago
  • 13.1.1                                ...           8 years ago
  • 13.1.0                                ...           8 years ago
  • 13.0.0                                ...           9 years ago
  • 12.1.5-alpha.b5322422                                ...           9 years ago
  • 12.1.4-alpha.a737c6e5                                ...           9 years ago
  • 12.1.3-alpha.6230044c                                ...           9 years ago
  • 12.1.2-alpha.6230044c                                ...           9 years ago
  • 12.1.2-alpha.a482b15c                                ...           9 years ago
  • 12.1.1-alpha.2935e14d                                ...           9 years ago
  • 12.1.0                                ...           9 years ago
  • 12.0.2                                ...           9 years ago
  • 12.0.1                                ...           9 years ago
  • 12.0.0                                ...           9 years ago
  • 11.0.2                                ...           9 years ago
  • 11.0.1                                ...           9 years ago
  • 11.0.0                                ...           9 years ago
  • 10.0.3                                ...           9 years ago
  • 10.0.2                                ...           9 years ago
  • 10.0.1                                ...           9 years ago
  • 10.0.0                                ...           9 years ago
  • 9.0.3                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
  • 0.0.3                                ...           9 years ago
  • 0.0.2                                ...           9 years ago
  • 0.0.1                                ...           9 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE