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.
29.1.0
[expect, @jest/expect]
Support type inference for function parameters in CalledWith
assertions (#13268)[expect, @jest/expect]
Infer type of *ReturnedWith
matchers argument (#13278)[@jest/environment, jest-runtime]
Allow jest.requireActual
and jest.requireMock
to take a type argument (#13253)[@jest/environment]
Allow jest.mock
and jest.doMock
to take a type argument (#13254)[@jest/fake-timers]
Add jest.now()
to return the current fake clock time (#13244, #13246)[@jest/mock]
Add withImplementation
method for temporarily overriding a mock (#13281)[expect]
Export toThrow*
matchers (#13328)[jest-circus, jest-jasmine2]
Fix error messages for Node's assert.throes
(#13322)[jest-haste-map]
Remove __proto__
usage (#13256)[jest-mock]
Improve spyOn
typings to handle optional properties (#13247)[jest-mock]
Fix mocking of getters and setters on classes (#13145)[jest-snapshot]
Throw useful error when an array is passed as property matchers (#13263)[jest-snapshot]
Prioritize parser used in the project (#13323)[jest-transform]
Attempt to work around issues with atomic writes on Windows (#11423)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.