Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
jest-resolve
Advanced tools
The jest-resolve package is a module resolver used by Jest, the JavaScript testing framework. It resolves the location of modules in your project, allowing Jest to hook into the module resolution logic. This is particularly useful for mocking modules or creating custom resolution logic for tests.
Resolving modules
This feature allows you to resolve the path to a module within your project. You can specify directories and file extensions to consider during resolution.
const Resolver = require('jest-resolve');
const resolver = new Resolver({}, {
moduleDirectory: ['node_modules'],
extensions: ['.js', '.json', '.jsx', '.ts', '.tsx', '.node']
});
const resolvedPath = resolver.resolveModule('/path/to/project', 'module-name');
Creating a custom resolver
This feature enables you to create a custom resolver function that can be used by Jest to resolve modules according to your specific needs.
const Resolver = require('jest-resolve');
const customResolver = (request, options) => {
// Custom resolution logic here
return Resolver.findNodeModule(request, options);
};
The 'resolve' package is a module resolution library that can be used independently of any test framework. It provides similar functionality to jest-resolve but is not tied to Jest. It's more generic and can be used in a variety of different projects.
This package is used internally by webpack for module resolution. It offers a highly configurable resolution mechanism that can handle complex scenarios like resolving modules based on file system state or package descriptions. It's more powerful than jest-resolve but also more complex to configure.
browser-resolve is a resolver for browser-based modules. It's similar to jest-resolve but focuses on resolving modules in a way that's compatible with the browser environment, taking into account the browser field in package.json files.
23.6.0
[jest-cli]
Add changedSince
to allowed watch mode configs (#6955)[babel-jest]
Add support for babel.config.js
added in Babel 7.0.0 (#6911)[jest-resolve]
Add support for an experimental mapper
option (Watchman crawler only) that adds virtual files to the Haste map (#6940)[jest-resolve]
Only resolve realpath once in try-catch (#6925)[expect]
Fix TypeError in toBeInstanceOf
on null
or undefined
(#6912)[jest-jasmine2]
Throw a descriptive error if the first argument supplied to a hook was not a function (#6917) and (#6931)[jest-circus]
Throw a descriptive error if the first argument supplied to a hook was not a function (#6917) and (#6931)[expect]
Fix variadic custom asymmetric matchers (#6898)[jest-cli]
Fix incorrect testEnvironmentOptions
warning (#6852)[jest-each]
Prevent done callback being supplied to describe (#6843)[jest-config]
Better error message for a case when a preset module was found, but no jest-preset.js
or jest-preset.json
at the root (#6863)[jest-haste-map]
Catch crawler error when unsuccessfully reading directories (#6761)[docs]
Add custom toMatchSnapshot matcher docs (#6837)[docs]
Improve the documentation regarding preset configuration (#6864)[docs]
Clarify usage of --projects
CLI option (#6872)[docs]
Correct failure-change
notification mode (#6878)[scripts]
Don’t remove node_modules from subdirectories of presets in e2e tests (#6948)[diff-sequences]
Double-check number of differences in tests (#6953)FAQs
Unknown package
The npm package jest-resolve receives a total of 12,265,248 weekly downloads. As such, jest-resolve popularity was classified as popular.
We found that jest-resolve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.