jest-util
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@jest/types | 29.6.3 | 8 kB | MIT | prod | |
@types/node | 20.12.11 | 1.96 MB | MIT | prod | |
chalk | 4.1.2 | 11.31 kB | MIT | prod | |
ci-info | 3.9.0 | 7.21 kB | MIT | prod | |
graceful-fs | 4.2.11 | 9.57 kB | ISC | prod | |
picomatch | 2.3.1 | 23.72 kB | MIT | prod |
The jest-util, now marked as '@jest/utils', is a collection of utility and helper functions designed to tailor a smoother and more productive experience for Jest users. These utilities are a set of versatile tools that accomplish various tasks which include formatting time values, deep copying, throwing custom errors, ensuring compatibility between ESM and CommonJS modules amongst many others. From performing checks to see if the environment is suitable for terminal interactions to functions designed for interactive command-line tools, @jest/utils has a wide range of functionalities that aim to enhance and simplify a wide spectrum of coding tasks.
Using the jest-util package (now '@jest/utils') isn't a one-size-fits-all process, given that it provides a plethora of utility functions designed for diverse tasks. For example, if you should need to create a directory, employ the 'createDirectory
' function. Here's an illustrative piece of code:
const { createDirectory } = require('@jest/utils');
createDirectory('./new_directory');
Likewise, to import a module and ensure its compatibility between ESM and CommonJS modules, you would use 'interopRequireDefault
' function. Here's an example:
const { interopRequireDefault } = require('@jest/utils');
const someModule = interopRequireDefault(require('./someModule'));
So, make sure to refer to the specific function you want to use and integrate it accordingly.
For complete and comprehensive documentation on the jest-util tool now under the banner of '@jest/utils', you can head to Jest's GitHub repository at https://github.com/jestjs/jest. There, you'll find detailed descriptions and usage examples for all the utility functions that this package offers, from 'ErrorWithStack
' and 'deepCyclicCopy
' to 'requireOrImportModule
' and beyond. This wealth of information is designed to help users take full advantage of these utilities, making Jest a more potent testing framework.