Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
malaviya-parth authored Sep 5, 2023
1 parent 70cc622 commit b79ca5e
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions packages/jest-util/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,65 @@

This packages is a collection of utilities and helper functions

## [clearLine.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/clearLine.ts)
- 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.
## `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.

## [createDirectory.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/createDirectory.ts)
- It creates new directory and also allows creation of nested directories.
## `createDirectory`
It creates new directory and also allows creation of nested directories.

## [ErrorWithStack.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/ErrorWithStack.ts)
- 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.
## `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.

## [installCommonGlobals.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/installCommonGlobals.ts)
- 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.
## `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.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/interopRequireDefault.ts)
- Provides a way to ensure compatibility between ES modules and CommonJS modules by handling the default export behavior appropriately.
## `interopRequireDefault`
Provides a way to ensure compatibility between ES modules and CommonJS modules by handling the default export behavior appropriately.

## [isInteractive.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/isInteractive.ts)
- Checks whether the current environment is suitable for interactive terminal interactions.
## `isInteractive`
Checks whether the current environment is suitable for interactive terminal interactions.

## [isPromise.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/isPromise.ts)
- 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.
## `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.

## [setGlobal.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/setGlobal.ts)
- 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.
## `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.

## [deepCyclicCopy.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/deepCyclicCopy.ts)
- 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.
## `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.

## [convertDescriptorToString.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/convertDescriptorToString.ts)
- 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.
## `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.

## [specialChars.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/specialChars.ts)
- 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.
## `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.

## [replacePathSepForGlob.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/replacePathSepForGlob.ts)
- 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.
## `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.

## [testPathPatternToRegExp.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/testPathPatternToRegExp.ts)
- This function is used for consistency when serializing/deserializing global configurations and ensures that consistent regular expressions are produced for matching test paths.
## `testPathPatternToRegExp`
This function is used for consistency when serializing/deserializing global configurations and ensures that consistent regular expressions are produced for matching test paths.

## [globsToMatcher.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/globsToMatcher.ts)
- 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.
## `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.

## [preRunMessage.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/preRunMessage.ts)
- 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.
## `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.

## [pluralize.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/pluralize.ts)
- 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.
## `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.

## [formatTime.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/formatTime.ts)
- 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.
## `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.

## [tryRealpath.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/tryRealpath.ts)
## `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.

## [requireOrImportModule.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/requireOrImportModule.ts)
- 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.
## `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.

## [invariant.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/invariant.ts)
- 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.
## `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.

## [isNonNullable.ts](https://github.com/jestjs/jest/blob/v29.6.4/packages/jest-util/src/isNonNullable.ts)
- 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.
## `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.

0 comments on commit b79ca5e

Please sign in to comment.