Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-resolve

Package Overview
Dependencies
Maintainers
3
Versions
274
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-resolve

  • 13.2.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is jest-resolve?

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.

What are jest-resolve's main functionalities?

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);
};

Other packages similar to jest-resolve

FAQs

Package last updated on 07 Jul 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc